Using time series objects
In this recipe, we look at various features to create and plot time-series objects. We will consider data with single and multiple time series.
If you have not already downloaded the data files for this chapter, do it now and ensure that the files are in your R working directory.
How to do it...
- Read the data. The file has 100 rows and a single column named
> s <- read.csv("ts-example.csv")
- Convert the data to a simplistic time series object without any explicit notion of time:
> s.ts <- ts(s) > class(s.ts)  "ts"
- Plot the time series:
- Create a proper time series object with time points:
> s.ts.a ...