user3706202
user3706202

Reputation: 215

CSV file is not recognized

Im exporting an excel file into a .csv file (cause I want to import it into R) but R doesn't recognize it.

I think this is because when I open it in notepad I get:

Item;Description
1;ja
2;ne

While a file which does not have any import issues is structured like this in notepad:

"Item","Description"
"1","ja"
"2","ne"

Does anybody know how I can either export it from excel in the right format or import a csv file with ";" seperator into R.

Upvotes: 0

Views: 1254

Answers (1)

Ben Bolker
Ben Bolker

Reputation: 226522

It's easy to deal with semicolon-delimited files; you can use read.csv2() instead of read.csv() (although be aware this will also use comma as the decimal separator character!), or specify sep=";".

Sorry to ask, but did you try reading ?read.csv ? The relevant information is in there, although it might admittedly be a little overwhelming/hard to sort out if you're new to R:

sep: the field separator character. Values on each line of the file are separated by this character. If ‘sep = ""’ (the default for ‘read.table’) the separator is ‘white space’, that is one or more spaces, tabs, newlines or carriage returns.

Upvotes: 4

Related Questions