[R] Reading in a csv - 2 different results

David Winsemius dwinsemius at comcast.net
Sat Jun 21 20:20:04 CEST 2014


On Jun 20, 2014, at 3:42 AM, svendeswan wrote:

> Hi,
> I am a beginner in R and already read and (thought that I) understood the R
> introduction tutorial. However there is this reading .csv which I cant
> solve. The question is: Why has data in the both cases a different content?
> 
> I have a directory containing one .csv file. 
> 
> Version 1:
> data <- read.csv(<<dir+filename>>)
> 
> Version 2:
> temp <- paste(c("dir/"), list.files("dir"), sep = "“)
# In the line above we see non-matching double quotes. I would have guessed that it would throw an error or simple ask you for more input due to the non matching quotes..
> data <- sapply(temp, read.csv)

If that is not the problem (and I suspect is is a typo, then without knowing he specifics of the differences, I do not see it as answerable in it present form.


> Thanks for the replies and sorry if this question has been posted already
> and I didn't see it,
> Sven 
> 
> p.s.: I am asking this because Version 2 gives me the possibility to read a
> whole directory with .csv files into one list
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Reading-in-a-csv-2-different-results-tp4692434.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list