[R] str() to extract components

Simon Pickett S.Pickett at exeter.ac.uk
Tue Feb 27 16:52:54 CET 2007


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



More information about the R-help mailing list