[R] question on formula and terms.formula()

pangdu at vt.edu pangdu at vt.edu
Wed Jul 13 05:40:27 CEST 2011


I'm trying to create a formula object to pass on to a function that  
applies the function terms.formula() to it.

f <- function(formula, ...)
{
...
mf <- match.call()
term <- terms.formula(mf$formula)
...
}

However, my code below gives an error.

form <- as.formula("y~x")
f(form, ...)

The error message was:
Error in terms.formula(mf$formula): argument is not a valid model.

Could anybody help me figure out the problem and find a solution here?



More information about the R-help mailing list