【发布时间】:2020-08-18 23:29:39
【问题描述】:
- 此代码运行良好
FL.POP = read.csv("C:\\Users\\jevans\\Desktop\\Jessica School\\Florida population 2010-2019.csv", header = TRUE )
Year <- as.numeric(FL.POP$Year)
Population <- as.numeric(FL.POP$Population_Estimation)
model<-lm(Population~Year)
model
plot(formula=(Population~Year),data=FL.POP,main='Florida Population')
abline(reg=lm(formula=(Population~Year),data=FL.POP),col='red')
summary(FL.POP)
new.years<- data.frame(Year = c(2019,2020,2021,2022,2023,2024,2025))
NewData<-predict(model,newdata = new.years)
NewData
new.pop<- data.frame(Population = c(NewData))
new.pop
new.years
-我无法将新的预测和新年附加到我的原始数据中,以便绘制出来。
【问题讨论】:
-
你试过
rbind.data.frame(old_dataframe, new_dataframe)吗?