[R] How to import data from a text file in R

John Kane jrkrideau at inbox.com
Sun Nov 25 14:29:53 CET 2012


Save the file as a csv file and try something like this:
       mydata <- read.csv("xxxx.csv",  header = FALSE)

John Kane
Kingston ON Canada


> -----Original Message-----
> From: claudio.diloreto at carloalberto.org
> Sent: Sun, 25 Nov 2012 03:29:42 -0800 (PST)
> To: r-help at r-project.org
> Subject: [R] How to import data from a text file in R
> 
> Hi,
> 
> I'd like to import a 154x1 vector of a stock monthly returns from a text
> (or
> excel spreadsheet) into R. I need to work on this vector by calculating
> mean, variance and use it for more complex operations. What is the best
> function to do so? There are no headers, just 154 decimale numbers (so
> there
> also negative numbers).
> 
> Thanks,
> 
> Claudio
> 
> 
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/How-to-import-data-from-a-text-file-in-R-tp4650718.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.

____________________________________________________________
FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!




More information about the R-help mailing list