Try this:
all.vars(substitute(y ~ poly(x, k) + z, list(k = NA)))
Or if you don't want substitute the var k:
gsub(".*\\((.*),.*", "\\1", rownames(attr(terms(y ~ poly(x, k) + z),
'factors')))
On Thu, Mar 4, 2010 at 6:57 AM, Vito Muggeo (UniPa)
wrote:
> dear all,
> When I use all.vars(), I am in
dear all,
When I use all.vars(), I am interest in extracting only the variable names..
Here a simple example
all.vars(as.formula(y~poly(x,k)+z))
returns
[1] "y" "x" "k" "z"
and I would like to obtain
"y" "x" "z"
Where is the trick?
many thanks
vito
--
Vi
2 matches
Mail list logo