[R] lme: extract result-function

Rui Barradas ruipbarradas at sapo.pt
Wed Jun 13 10:32:33 CEST 2012


Hello,

Try


f <- function(response, regressors)
	as.formula(paste(response, paste(regressors, collapse=" + "), sep=" ~ "))


(resp <- "A")
(regr <- c(-1, LETTERS[2:7]))

fmla <- f(resp, regr)


Hope this helps,

Rui Barradas

Em 13-06-2012 09:21, Christof Kluß escreveu:
> Hi,
>
> mod <- lme(A ~ -1 + B+C+D+E+F+G, random = ~1 | ...)
>
> results in summary(mod)$coeff
>
> B C D E F G (Intercept)
> b c d e f g i
>
> Now I'm interested in the function
>
> f <- function(B,C,D,E,F,G) <- {
>    return(i + b*B + c*C + d*D + e*E + f*F + g*G)
> }
>
> Is there a easier way to create such function with flexible number of
> coefficient, than do it by hand?
>
> thx
> Christof
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list