R Time Series plot.ts() -


i trying read in time series , plot.ts(), getting weird results. perhaps did wrong. tried including start , end dates output still wrong. appreciated. thank you.

this code , output:

sales1 <- read.csv("times.csv",header=true) sales1  salest <- ts(sales1) salest plot.ts(salest)  output: > sales1 <- read.csv("times.csv",header=true) > sales1    year  q1  q2  q3  q4 1 1991 4.8 4.1 6.0 6.5 2 1992 5.8 5.2 6.8 7.4 3 1993 6.0 5.6 7.5 7.8 4 1994 6.3 5.9 8.0 8.4  > salest <- ts(sales1) > salest  time series: start = 1  end = 4  frequency = 1    year  q1  q2  q3  q4 1 1991 4.8 4.1 6.0 6.5 2 1992 5.8 5.2 6.8 7.4 3 1993 6.0 5.6 7.5 7.8 4 1994 6.3 5.9 8.0 8.4  > plot.ts(salest)   looks can't paste plot.  instead of 1 graph has 5 separate      plots stacked onto each other. 

the format of original data difficult use directly time series. try instead:

sales1 <- t(sales1[,-1]) sales1 <- as.vector(sales1) my_ts <- ts(sales1, frequency = 4, start=c(1991,1)) plot.ts(my_ts) 

enter image description here


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -