Try this:
evaluate.all <- function(response, DF = iris) {
DF <- cbind(response = DF[[response]], DF)
L <- list(
# some linear models:
B1 = try(lm(response ~ Sepal.Length, DF)),
L2 = try(lm(response ~ Sepal.Width, DF)),
# s
Dear R users,
I have written a function that runs several statistical models and extracts
the AIC values from them.
As a (nonsense) example, I use the iris dataset:
#
data(iris)
attach(iris)
evaluate.all=function(response,...){
response=get(response) #retrieves the response variab
2 matches
Mail list logo