[R] Data() and CSV files

McGehee, Robert Robert.McGehee at geodecapital.com
Wed Apr 27 17:18:51 CEST 2005


Hello,

For reasons I don't understand, data() imports CSV (Comma-Separated
Values) as if they were delimited by semicolons instead of commas. (Are
semicolon-separated Comma-Separated-Value files common somewhere?) Given
that this is the case, if I choose to put comma-delimited CSV files in
my data directory, what is the preferred method of loading these into
memory?

data("filename")
would be nice, but not applicable given the above conversion issue.

So, this was the best I came up with:

read.csv(file.path(.find.package("pkg"), "data", paste("filename",
"csv", sep = ".")))

However, given that others undoubtedly like to include (non-semicolon)
.csv files in their packages and load them easily, I would like to know
if there is a more elegant way to load these files. Perhaps an
annotation in the data/00Index or /data/datalist file that I am unaware
of?

Thanks,
Robert




More information about the R-help mailing list