R only recognizes 1 variable out of 2

Hi, there new to RStudio, trying to import a csv-file with 2 variables but RStudio keeps not recognizing the second variable

Only look at the code line at the bottom of the console, on top you see that the spreadsheet that RStudio creates only has one column instead of two.

On the left is the CSV file.

I need the grade and age column to be separated like it is in excel.

What am I doing wrong?

It looks like your file uses a semicolon as the separator but the read.csv function assumes the separator is a comma. Use either

read.csv(file.choose(), sep = ";")

or

read.csv2(file.choose())

The header argument is TRUE by default in both cases, so there is no need to set it, though there is no harm in doing so.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.