I am looking for functions that will allow me to plot daily time series like this one:
My data is daily data like this one
Date=seq(as.Date("1910/1/1"), as.Date("1920/1/1"), "day")
Values=runif(length(Date), min=-5, max=5)
dataset=data.frame(Values,as.Date(Date))
> head(dataset)
values date
1 0.08088151 1910-01-01
2 -1.05188542 1910-01-02
3 -2.58417814 1910-01-03
4 4.12488211 1910-01-04
5 -4.63117081 1910-01-05
6 4.75016821 1910-01-06
I have tried to create a ts object with no sucess
ts(dataset[,1],start=c(1910,1), frequency=7)
All I want to do is:
- plot for the time range “1910/1/1” to “1920/1/1” (this I can do)
- add the monthly “moving average”, just add the line of the average value per month
- add a trend line (is the values increasing or decreasing over time)
Please look at the zoo package for an excellent start with many examples in the package documentation, and consider other R packages as recommended by the R Task Views on the CRAN web site(s).