简体   繁体   中英

Daily Time Series in R

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)

请查看Zoo软件包以获得一个很好的入门,其中包含软件包文档中的许多示例,并考虑CRAN网站上“ R任务视图”推荐的其他R软件包。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM