[R] Data manipulation
Roger Peng
rpeng at stat.ucla.edu
Fri Feb 7 23:48:03 CET 2003
You might want to try subsetting the data frame first, and then fit the
model. Something like
knap.sub <- knap[c(41:60,81:100,101:120,121:140), ]
knap.fit1 <- lm(Kweed ~ TREAT, data = knap.sub)
might work for you.
-roger
_______________________________
UCLA Department of Statistics
rpeng at stat.ucla.edu
http://www.stat.ucla.edu/~rpeng
On Fri, 7 Feb 2003, Lew wrote:
> I am interested in building a model with a subset of data from a column.
>
> The first 6 lines of my data look like this:
> QUAD YEAR SITE TREAT HERB TILL PLANT SEED Kweed
> 1 A4 2002 s 1 N N N N 55.00
> 2 A10 2002 s 1 N N N N 60.00
> 3 B2 2002 s 1 N N N N 35.00
> 4 C2 2002 s 1 N N N N 23.00
> 5 C9 2002 s 1 N N N N 70.00
> 6 11 2002 m 1 N N N N 22.00
>
> I tried this command to get the subset I want:
>
> > knap.fit1<-(lm(Kweed~TREAT[41:60,81:100,101:120,121:140], data=knap))
> No luck.
>
> Can anyone tell me how to code for this subset.
>
> Thanks
>
> Lew Stringer
> M.S. Student- Land Rehabilitation
> Dept. of Land Resources and Environmental Sciences
> Montana State University
> 822 Leon Johnson Hall
> Bozeman, MT 59717
> Lab:(406)994-6811
> Fax:(406)994-3933
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
More information about the R-help
mailing list