I am trying to predict using simple linear model. But everytime I get warning:
Warning message: 'newdata' had 2 rows but variables found have 62 rows
Here is my code:-
fit<-lm(mean ~ year,data=data)
fit
summary(fit)
years<-data.frame(year=c(2020,2019))
predict.lm(m,newdata = years)
It is a simple data set containing year (till 2020) and carbon emission as columns. and I am trying to predict carbon emission for year 2030.