Time Series in R


here is my question:
I have this data

 summary(data)

   Date                  
 1990/01:  1                
 1990/02:  1               
 1990/03:  1                
 1990/04:  1               
 1990/05:  1               
 1990/06:  1               
 (Other):242               

  attribute
 Min.   :164.9  
 1st Qu.:201.5  
 Median :244.1  
 Mean   :274.6  
 3rd Qu.:313.3  
 Max.   :512.1  
 NA   :  1.0  

and I want to draw a time series graph

so i tried this:

qplot(as.Date(Date, "%Y/%m/%d"), attribute, data = data, geom = "line", main="Attribute per month 1990-2010", xlab="month-year", ylab="attribute" , colour = I("steelblue4"),fill = I("steelblue4"))

and I got:
Error in seq.int (r1 $ year, to $ year, by): 'from' must be finite
In addition: Warning messages:
1: In min (x): no non-empty arguments up to min; return Inf
2: In max (x): no arguments without skipping to max; return -Inf

any ideas to solve it?

Thank you

+3
source share
1 answer

This conversion as.Date(Date, "%Y/%m/%d")gives you NAfor all values.

Give it a try as.Date(paste(Date,"01",sep="/"), "%Y/%m/%d").

+3
source

Source: https://habr.com/ru/post/1768490/


All Articles