I wanted to create a list of models that will be used to fit my data.
Code Below
models = list("naiveBayes","rf")
for(model_name in models){
print(model_name)
formual = V35 ~ .
model = model_name(formual,data=train)
}
The error I get
Error: could not find function "model_name"
model_nameis a string and not a function, what made you think that this would work? Also, did you look at thecaretpackage? it's tailor made to help do things like this. Also,rfis ambiguous since there's astats::rf()butrfis naming shorthand in thecaretpackage. also,modelis only ever going to hold the last model since you're not making a list.caret packagedoes not have the models I am looking for.