[R] Help!
Erich Neuwirth
erich.neuwirth at univie.ac.at
Tue Sep 21 00:02:46 CEST 2010
If you assume that the variance is the same in all your subsets,
you can do an lm analysis with your subset classification as a factor.
You could also analyze the interaction between factors
and between factors and your numeric independent variable.
You also should consider repeated measurement methods since
you are taking 2 cores from the same individuals.
On 9/20/2010 11:46 PM, Oyomoare Osazuwa-Peters wrote:
> Please I need some help using R to
> analyze my data. What I
> would like to do is to repeat the same basic process (e.g. linear regression
> between wood density and distance from pith) for at least 240 data
> subsets
> within the main data-frame. Within the main data-frame, these data subsets will be defined by three
> variables
> namely, Â species, individual and core (i.e. 20 species, at least 6
> individuals
> of each species, and 2 cores from each individual). Â Whereas I can write
> the code to carry out this process for each subset, I am unable to
> successfully
> instruct R to automatically carry out the process for each of these
> subsets (perhaps using loops). So to illustrate what I have done so far
> with the codes
> below I was able to run a regression
> analysis for core âaâ of individual 1 in
> the species âApeimeâ. But rather than do this 240 times, I would like to
> tell R
> to repeat the process automatically using loops or any method that
> works.
>
> Â
>
> Code:
>
> Â
>
> RG2<-BCI[BCI$Species == "APEIME"
> &
> BCI$Individual == 1 & BCI$Core == "a", ]
>
>> plot(x=RG2$DP..cm.,
> y=RG2$WD..g.cm3,
> xlab="Distance from pith cm", main="APEIME1a",
> ylab="Wood density g/cm3")
>
>>
> RG2lm<-lm(RG2$WD..g.cm3~RG2$DP..cm.)
>
>> summary(RG2lm)
>
> Â
>
> Thanks
>
> Â
>
> Oyomoare
>
>
>
>
>
> [[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