I'm looking for a quick way to pull out the number of observations (N
) generated in the summary of a lme
test, instead of copying and pasting? I found this online but the command doesn't appear to be built-in and the texreg
package isn't uploaded to this site.
n <- nobs(model) #extract number of observations
Many thanks.
library(nlme)
x <- 1:80
g <- sort(rep(c(1,2,3,4),20))
set.seed(1)
y <- 3*x+g*0.01+rnorm(80,sd=0.01)
plot(y~x)
fit <- lme(y~x,random=~1|g)
nobs(fit)
[1] 80 #works just fine
fit$dims$N
[1] 80 #alternative