[R] How to figure the type of a variable?
Peng Yu
pengyu.ut at gmail.com
Sun Sep 6 18:33:55 CEST 2009
Hi,
I want to know what is there returned values of 'lm'. 'class' and 'lm'
does not show that the returned value has the variable coefficients,
etc. I am wondering what is the command to show the detailed
information. If possible, I aslo want the lower level information. For
example, I want to show that 'coefficients' is a named list and it has
2 elements.
Regards,
Peng
> x=1:10
> y=1:10
> r=lm(x~y)
> class(r)
[1] "lm"
> mode(r)
[1] "list"
> r
Call:
lm(formula = x ~ y)
Coefficients:
(Intercept) y
1.123e-15 1.000e+00
> r$coefficients[1]
(Intercept)
1.123467e-15
> r$coefficients[[1]]
[1] 1.123467e-15
> r$coefficients[2]
y
1
> r$coefficients[[2]]
[1] 1
>
More information about the R-help
mailing list