Commit | Line | Data |
---|---|---|
a961f8a1 BA |
1 | expertsArray = c( |
2 | "CLM", #1 | |
3 | "GAM", #2 | |
4 | "CLM1", #3 | |
5 | "CLM2", #4 | |
6 | "S_AIRPARIF", #5 | |
7 | "S_INERIS", #6 | |
8 | "D_ESMERALDA", #7 | |
9 | "D_PREVAIR", #8 | |
10 | "D_PREVAIR2", #9 | |
11 | "PERSIST", #10 | |
12 | #new additions only for PQV_2014 | |
13 | #TODO: default behavior on station != PQV_2014 ? | |
14 | "GAM_sepMar", #11 | |
15 | "GAM_aprAug", #12 | |
16 | "GAM_highPollution", #13 | |
17 | "GAM_lowPollution", #14 | |
18 | "GAM_hotTemperature", #15 | |
19 | "GAM_coldTemperature", #16 | |
20 | "GAM_eastWind", #17 | |
21 | "GAM_westWind", #18 | |
22 | "GAM_noRain", #19 | |
23 | "GAM_rain" #20 | |
24 | ) | |
25 | ||
26 | stationsArray = c( | |
27 | "AIL", #1 | |
28 | "ALE", #2 | |
29 | "CAE", #3 | |
30 | "CHD", #4 | |
31 | "EVT", #5 | |
32 | "HRI", #6 | |
33 | "IFS", #7 | |
34 | "JUS", #8 | |
35 | "LIS", #9 | |
36 | "MAS", #10 | |
37 | "MRA", #11 | |
38 | "NEI", #12 | |
39 | "POS", #13 | |
40 | "PQV", #14 | |
41 | "SLO", #15 | |
42 | "HRI_2014", #16 | |
43 | "LIS_2014", #17 | |
44 | "PQV_2014", #18 | |
45 | "PQV2" #19 | |
46 | ) | |
47 | ||
48 | #' @title Get forecasts + observations | |
49 | #' | |
50 | #' @description Get forecasts of all specified experts for all specified stations, also with (ordered) dates and (unordered) stations indices. | |
51 | #' | |
52 | #' @param experts Names of the experts. Default: all | |
53 | #' @param station Names of the stations. Default: all | |
54 | #' | |
55 | #' @export | |
56 | getData = function(experts=expertsArray, stations=stationsArray) | |
57 | { | |
58 | #no need because of "LazyData: true" in DESCRIPTION | |
59 | #data(list=stations, package="aggexp") | |
60 | data = as.data.frame(matrix(nrow=0, ncol=1 + length(experts) + 2)) | |
61 | names(data) = c("Date", experts, "Measure", "Station") | |
62 | for (i in 1:length(stations)) | |
63 | { | |
64 | stationInfo = get(stations[i]) | |
65 | #date index is sufficient; also add station index | |
66 | stationInfo = cbind(Date = 1:nrow(stationInfo), stationInfo[,names(stationInfo) %in% experts], Measure = stationInfo[,"Measure"], Station = i) | |
67 | data = rbind(data, stationInfo) | |
68 | } | |
69 | ||
70 | #extra step: order by date (would be a DB request) | |
71 | data = data[order(data[,"Date"]),] | |
72 | ||
73 | return (data) | |
74 | } |