[R] New to List - just starting to learn R - question about reading in data

Erik Iverson iverson at biostat.wisc.edu
Sat Nov 8 05:38:46 CET 2008


Dirty D wrote:
> Hi, everyone,
> I'm new to R and the List, and excited to be here.  I am coming from a 
> background working in SPSS 16, primarily, which has a lot of easy 
> options for reading in data.  I am working in R in an Ubuntu Linux 
> environment, and I'm learning with R Commander.

I work with R in Ubuntu also, it is a good decision I think.  I use ESS 
(a package for Emacs), however.

> Now, here's my question. In my line of work, I'm used to getting data in 
> some kind of flat ASCII format with a separate file indicating which 
> columns correspond to which variables.  In the Venables and Ripley book 
> on S/R that I'm reading, there doesn't seem to be a way to read this 
> kind of data format into R, and I haven't found anything online.

Certainly, look up read.table (?read.table in R) and in V&R, bottom of 
page 21 specifically.  There is also an R Data Import/Export manual on 
the project's site.  But, read.table is almost surely what you're 
looking for.

test <- read.table("/path/to/file", header = TRUE)

This is a common example if your text file has a first row of variable 
names. See pages 21-22 for more examples.


> If anyone has the tine, I'd sure appreciate a little guidance.
> Thanks,
> DD
> ______________________________________________
> 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.

More information about the R-help mailing list