R-beta: vectors in dataframe?

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Mon Apr 27 23:47:10 CEST 1998


Bill Simpson <wsimpson at uwinnipeg.ca> writes:

> > thingy<-read.table(file="rstuff/output.cif3")
> > thingy$tau1
> NULL
> > thingy[,"tau1"]
> Error: subscript out of bounds
> > attach(thingy)
> > tau1
> Error: Object "tau1" not found
>  but
> > thingy
> lists the row number, tau1, tau2, p3cond
> i.e. all the data as 4 cols of numbers (up to row 1601).

My students keep doing that too... 

If you look more closely, you'll see that what looks like column names
are really the first line of observations. You need to tell R that the
first line of the input file contains the column names

read.table(....., header=T)

should do it. And for a sanity check on your data frames, I suggest to
make a habit of

summary(thingy)

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list