[R] simple data import of .csv

William Revelle lists at revelle.net
Sat Apr 10 22:58:38 CEST 2010


>Hello,
>
>I am a complete beginner to R.  I use a mac and want to import and read a
>.csv dataset stored as .csv file.
>
>I understand I eventually enter <- read.csv("size.csv", header=T)   , but I
>can't get R to find my file, which is called size.csv and located
>/Users/davidoconnor/Desktop/Eart-125/size.csv
>
>Thank you very much!
>
>David
>--
>View this message in context: 
>http://n4.nabble.com/simple-data-import-of-csv-tp1835620p1835620.html
>Sent from the R help mailing list archive at Nabble.com.

Two solutions:

To find the file, use file.choose()
e.g.,
my.file.name <- file.choose()    #and then use the normal mac tools 
to find the file
my.data <- read.csv(my.file.name,header=TRUE)

or, if you want to just read it from the clipboard:

library(psych)
my.data <- read.clipboard.csv()    #after copying the data to the clipboard

Bill


>
>______________________________________________
>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.


-- 
William Revelle		http://personality-project.org/revelle.html
Professor			http://personality-project.org
Department of Psychology             http://www.wcas.northwestern.edu/psych/
Northwestern University	http://www.northwestern.edu/
Use R for psychology                       http://personality-project.org/r
It is 6 minutes to midnight	http://www.thebulletin.org



More information about the R-help mailing list