Question: I have a exercise on Machine learning (Data Analysis) for predicting the price of cars. For that I am using R. I import the dataset

I have a exercise on Machine learning (Data Analysis) for predicting the price of cars. For that I am using R.

I import the dataset cars<-read.csv("import-85.csv", header=true, sep=",")

I display the datset str(cars)

and also summar(cars)

My next step is to run the lm command

I did this:

set.seed(1234)

ind<-sample(2, nrow(cars), replace=true, prob=c(0.7, 0.3))

train.cars<-cars[ind == 1, ]

test.cars<-cars[ind == 2,

everything till this point

Now to implement my model:

myformula<-cars~.

model<-lm(myformula, data=train.cars)

print(model)

I am receiving error message:

error in model.frame.default....)

type(list) incorrect for the variable 'cars'

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!