warning when calculating predicted values

前端 未结 4 1500
耶瑟儿~
耶瑟儿~ 2021-01-05 10:29

working with a data frame

x
    Date      Val
    1/1/2012   7
    2/1/2012   9
    3/1/2012   20
    4/1/2012   24
    5/1/2012   50
a <- seq(as.Date(tai         


        
4条回答
  •  囚心锁ツ
    2021-01-05 10:59

    Your data.frame a has a column named a. You created your model with columns named Val and Date so that is what its looking for.

    when you make your data.frame a name that column Date and you're good to go:

    a <- data.frame(Date=a)
    

    Then it runs without the warning.

    Per comment:

    Edit your lm call to be:

    lm(Val ~ Date, data=x)
    

提交回复
热议问题