[R] help for input

kjetil halvorsen kjetilh at umsanet.edu.bo
Mon Dec 17 19:21:51 CET 2001


You should probably convert Group to factor like
data$Group <- factor(data$Group)

the you can subset using 

data[data$Group == "1", ]

or you can use tapply


Kjetil Halvorsen

yiping.fan at syngenta.com wrote:
> 
> Hello, all,
>     I have a question regarding data input.  For example: I have a file like
> this
>        Group exp value
>  001 1  1   5
> 002   1  2  4
> 003   1  3  4
> 004  2   1  4
> 005 2    1  4
> 006  3    2  3
> 007  3   4 5
> 008  3  4  5
> 009   3  5  6
> I read it using
> f<-read.table("infile")
> we have 3 groups here,
> group1 have 3 exps
> group 2 havs 2 exps
> group 3 has 4 exps
> After I read the file,  how can I get the data for each group?   Thanks!
> 
> Yiping
> 
> 
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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