I am doing homework in R for my stats class and I was given these codes to put into R.
subset.output = regsubsets(y~x1+x2+...+x_p, data = name of data set, nbest = 1)
so with my variables I did the first step and then I entered this code into R
When I put that into R, this error pops up
Error in as.data.frame.default(data) :
cannot coerce class ‘"lm"’ to a data.frame
I have no idea what I'm doing wrong and my teacher isn't helping me, can someone please help me?