[R] str() to extract components
Joerg van den Hoff
j.van_den_hoff at fzd.de
Tue Feb 27 17:28:20 CET 2007
On Tue, Feb 27, 2007 at 03:52:54PM -0000, Simon Pickett wrote:
> 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.
>
may `unlist' would be enough?
More information about the R-help
mailing list