'object 'MEDV' not found -> but MEDV is in data set
I'm trying to write the equation to predict the median, first I need to fit a multiple linear regression model to the median house price (MEDV) as a function of CRIM, CHAS, and RM.
BostonHousing
n.training <- floor(nrow(data)*0.7)
id.training <- sample(1:nrow(data), n.training)
data.training <- data[id.training,]
data.test <- data[-id.training,]
mlr1 <-lm(MEDV ~ CRIM+CHAS+RM,data=data.training)
#Error in eval(predvars, data, env) : object 'CAT..MEDV' not found
I get an error in line 6 saying that MEDV is an object not found but it is on the file.
Solution 1:[1]
From the ISLR2 package...
lm.fit <-lm(medv ~ crim + chas + rm, data = Boston)
summary(lm.fit)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Harley |
