From the result you noted, I'll assume you're using a Portuguese version of Excel from Windows. Generally, when we save an Excel worksheet from Windows to CSV, it is saved with ;
as the separator. This happens mostly in Brazilian versions (some European too) of Excel, because our decimal separator is the comma, not the dot, as it is in the United States.
In R this is already somewhat anticipated by the read.csv2
function (see here ), which has the headers, decimals, and tabs setting that Windows Excel uses by default. See in function definition, making ?read.csv
read.csv(file, header = TRUE, sep = ",", quote = "\"",
dec = ".", fill = TRUE, comment.char = "", ...)
read.csv2(file, header = TRUE, sep = ";", quote = "\"",
dec = ",", fill = TRUE, comment.char = "", ...)
In addition to this possible solution, as Anthony said, there are packages that make it easy to read Excel files, such as xlsx
and gdata
. See here and here .