Day 6: Multiple Linear Regression: Predicting House Prices
-
-
AffineStructure 9 years ago when you did "lm(price ~ ., data=foo)" did you have the data saved in data frames?
I was having trouble doing it this way because price needs to be assigned to the last vector. did you just rename the final entry to price in the data frame or did you just have all the vectors floating free in the global environment?-
BryanRJ 9 years ago The "data=foo" argument there tells R that data are supposed to come from the frame named "foo".
I always recommend building a data frame before performing regression or other modeling. It makes things easier in R.
-
-
Or you can do "lm(price ~ ., data=foo)", which will create a linear regression model having price as the independent variable and all other columns in foo as dependent variables.
Re: printing, try "write(foo, stdout())", which will be a non-pretty print.
Add Reply Preview cancel