Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

R - elegant way to select multiple variables in model like rpart or train

$
0
0

I want to use around 50 variable columns of my data as factors for my model and try to figure out an elegant way instead of using a long list of all variables.

rpart(output_variable ~ Variable1 + Variable2 + Variable3 + Variable4, data=Train_Set, method="class")

I try

rpart(output_variable ~ dataset[,12:50], data=Train_Set, method="class")

but that just brings "invalid type (list)

any idea how I can elegantly select multiple variables or save them to reference them in a formula?


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>