[R] Odp: Newb question re. read.table...

Petr PIKAL petr.pikal at precheza.cz
Thu Mar 4 08:46:13 CET 2010


Hi

r-help-bounces at r-project.org napsal dne 03.03.2010 22:50:59:

> I'm trying to get started with R, on Ubuntu. I worked through the
> tutorial, and have made a small tab-delimited subset of my data to try
> out (10 cases with about a dozens variables). But I can't seem to figure
> out how to actually refer to variables. I presume I'm missing something
> very simple, but quite a while searching the doc and the FAQ haven't
> helped me.
> 
> I'm loading the data with
>     con <- read.table("tiny.txt", header=TRUE)
> 
> The first record is a set of variable names, tab-separated like the rest
> of the rows. There are no row labels, thus the same number of
> tab-delimited fields in the header record and the following records. The
> read.table returns silently, and I can get a reasonable summary(con).
> But if I try something like plot(rel,len), where rel and len are two of
> the labels from the header row, I get
> 
>      Error in plot(rel, len) : object 'rel' not found
> 
> I've tried many variations (different variables, adding "con." on the
> front, quoting, using field numbers instead of names, etc. I've also
> read what I can find on read.table, but I'm clearly missing some basic
> thing....
> 
> Can somebody put me back on the right track? Is there some additional
> thing I have to do to make this into a "real" frame, or to bind
> variables names to header names, or something like that?

You have got several answers, I would recommend also to read chapter 6.3 
of R intro for manipulating data frame.

Regards
Petr


> 
> Thanks, and sorry for being dense....
> 
> Steve
> 
> 
> 
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> 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