[R] str() to extract components

joris.dewolf at cropdesign.com joris.dewolf at cropdesign.com
Tue Feb 27 18:11:24 CET 2007


mod <- lmer(resp3~b$age+b$size+b$pcfat+(1|sex), data=b)
coef(mod)[1]$Subject[1,1]


r-help-bounces at stat.math.ethz.ch wrote on 27/02/2007 16:52:54:

> Hi,
>
> I have been dabbling with str() to extract values from outputs such as
> lmer etc and have found it very helpful sometimes.
>
> but only seem to manage to extract the values when the output is one
> simple table, any more complicated and I'm stumped :-(
>
> take this example of the extracted coeficients from a lmer analysis...
>
> using str(coef(lmer(resp3~b$age+b$size+b$pcfat+(1|sex), data=b))) yields
>
> Formal class 'lmer.coef' [package "Matrix"] with 3 slots
>   ..@ .Data :List of 1
>   .. ..$ :`data.frame': 2 obs. of  4 variables:
>   .. .. ..$ (Intercept): num [1:2] 1.07 1.13
>   .. .. ..$ b$age      : num [1:2] 0.00702 0.00702
>   .. .. ..$ b$size     : num [1:2] 0.0343 0.0343
>   .. .. ..$ b$pcfat    : num [1:2] 0.0451 0.0451
>   ..@ varFac: list()
>   ..@ stdErr: num(0)
>
> how do I "get inside" the first table to get the value 1.07 for instance?
>
> Any help much appreciated.
>
>
> Simon Pickett
> PhD student
> Centre For Ecology and Conservation
> Tremough Campus
> University of Exeter in Cornwall
> TR109EZ
> Tel 01326371852
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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