63002844cb3b8fbe72292c98b80143056e133e91
[aggexp.git] / pkg / R / d_dataset.R
1 #' Sample data built from DataMarket Rhine River time-series
2 #'
3 #' 3 "stations": original serie, reversed series, average of both.\cr
4 #' "Experts": persistence (P), moving average with window==3 (MA3) and 10 (MA10).\cr
5 #' -----\cr
6 #' Generating R code:\cr
7 #' library(rdatamarket)\cr
8 #' serie = dmseries("https://datamarket.com/data/set/22wp/rhine-river-near-basle-switzerland-1807-1957")\cr
9 #' dates = seq(as.Date("1807-07-01"),as.Date("1956-07-01"),"years")\cr
10 #' serie = list(serie, rev(serie), (serie+rev(serie))/2)\cr
11 #' st = list()\cr
12 #' for (i in 1:3) {\cr
13 #' st[[i]] = data.frame(\cr
14 #' Date=dates,\cr
15 #' P=c(NA,serie[[i]][1:149]),\cr
16 #' MA3=c(rep(NA,3),sapply(4:150, function(j) mean(serie[[i]][(j-3):(j-1)]) )),\cr
17 #' MA10=c(rep(NA,10),sapply(11:150, function(j) mean(serie[[i]][(j-10):(j-1)]) )),\cr
18 #' Measure=as.double(serie[[i]])
19 #' )\cr
20 #' }\cr
21 #' save(st, file="stations.RData")
22 #'
23 #' @name stations
24 #' @docType data
25 #' @usage data(stations)
26 #' @references \url{https://datamarket.com/data/set/22wp/rhine-river-near-basle-switzerland-1807-1957}
27 #' @format A list of 3 dataframes with 150 rows and 5 columns: Date,P,MA3,MA10,Measure
28 NULL