I wonder how to get the element of lsmobj
from lsmeans
package in R
.
require(lsmeans)
fiber.lm <- lm(strength ~ diameter + machine, data = fiber)
fiber.lsm <- lsmeans (fiber.lm, "machine")
fiber.lsm
machine lsmean SE df lower.CL upper.CL
A 40.38241 0.7236252 11 38.78972 41.97510
B 41.41922 0.7444169 11 39.78077 43.05767
C 38.79836 0.7878785 11 37.06426 40.53247
Confidence level used: 0.95
str(fiber.lsm)
'lsmobj' object with variables:
machine = A, B, C
I want extract lsmeans
and SE
columns of fiber.lsm.
fiber.lsm
is an S4 object that cannot be subsetted. But you can use thesummary
of the object. It returns a data frame of the model results.