need help with a code

sales<-read.csv("Y:/Documents/STAT/attachments/RestaurantSales.txt",header=T)
attach(sales)
Time<-as.numeric
fMonth<-as.factor
model1<-lm(Sales~Time+I(Time^2)+I(Time^3)+I(Time^4)+fMonth);summary(model1)
Error in Time^2 : non-numeric argument to binary operator

Please help me get rid of the error in the last line

The two lines

Time <- as.numeric
fMonth <- as.factor

are probably not doing what you think they are. They are storing the functions, not converting any column in the data set. Do you mean

Time <- as.numeric(Time)
fMonth <- as.factor(fMonth)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.