On May 26, 2015, at 8:30 AM, William Dunlap wrote:
> One way to use variable names in functions like Predict() that
> do not evaluate their arguments in the standard way is to use
> do.call() along with as.name(). E.g.,
> varName<-"age"
> do.call("Predict", list(fit, as.name(varName), np=4))})
One way to use variable names in functions like Predict() that
do not evaluate their arguments in the standard way is to use
do.call() along with as.name(). E.g.,
varName<-"age"
do.call("Predict", list(fit, as.name(varName), np=4))})
gives the same result as
Predict(fit, age, np=4)
Bill D
On Tue, May 26, 2015 at 5:14 AM, wong jane wrote:
> There are functions which use variable names as parameters in some R
> packages. However, if the variable name is stored in another variable, how
> can I pass this variable to the function. Taking the "rms" package as an
> example:
>
>
> libr
There are functions which use variable names as parameters in some R
packages. However, if the variable name is stored in another variable, how
can I pass this variable to the function. Taking the "rms" package as an
example:
library(rms)
n <- 1000
age <- rnorm(n, 50, 10)
sex <- factor(sample(c('f
4 matches
Mail list logo