X-Git-Url: https://git.auder.net/images/pieces/Cwda/wl.svg?a=blobdiff_plain;f=pkg%2FR%2Fz_getData.R;fp=pkg%2FR%2Fz_getData.R;h=0000000000000000000000000000000000000000;hb=57dbbab63a48b42f85e0a711640e1dd10b58f18a;hp=b4dd2ba108f1cffd8388d2bb4ac579965456b5fa;hpb=357b8be00388d07c04c10d4bf7f503fd947185d2;p=aggexp.git diff --git a/pkg/R/z_getData.R b/pkg/R/z_getData.R deleted file mode 100644 index b4dd2ba..0000000 --- a/pkg/R/z_getData.R +++ /dev/null @@ -1,74 +0,0 @@ -expertsArray = c( - "CLM", #1 - "GAM", #2 - "CLM1", #3 - "CLM2", #4 - "S_AIRPARIF", #5 - "S_INERIS", #6 - "D_ESMERALDA", #7 - "D_PREVAIR", #8 - "D_PREVAIR2", #9 - "PERSIST", #10 - #new additions only for PQV_2014 - #TODO: default behavior on station != PQV_2014 ? - "GAM_sepMar", #11 - "GAM_aprAug", #12 - "GAM_highPollution", #13 - "GAM_lowPollution", #14 - "GAM_hotTemperature", #15 - "GAM_coldTemperature", #16 - "GAM_eastWind", #17 - "GAM_westWind", #18 - "GAM_noRain", #19 - "GAM_rain" #20 -) - -stationsArray = c( - "AIL", #1 - "ALE", #2 - "CAE", #3 - "CHD", #4 - "EVT", #5 - "HRI", #6 - "IFS", #7 - "JUS", #8 - "LIS", #9 - "MAS", #10 - "MRA", #11 - "NEI", #12 - "POS", #13 - "PQV", #14 - "SLO", #15 - "HRI_2014", #16 - "LIS_2014", #17 - "PQV_2014", #18 - "PQV2" #19 -) - -#' @title Get forecasts + observations -#' -#' @description Get forecasts of all specified experts for all specified stations, also with (ordered) dates and (unordered) stations indices. -#' -#' @param experts Names of the experts. Default: all -#' @param station Names of the stations. Default: all -#' -#' @export -getData = function(experts=expertsArray, stations=stationsArray) -{ - #no need because of "LazyData: true" in DESCRIPTION - #data(list=stations, package="aggexp") - data = as.data.frame(matrix(nrow=0, ncol=1 + length(experts) + 2)) - names(data) = c("Date", experts, "Measure", "Station") - for (i in 1:length(stations)) - { - stationInfo = get(stations[i]) - #date index is sufficient; also add station index - stationInfo = cbind(Date = 1:nrow(stationInfo), stationInfo[,names(stationInfo) %in% experts], Measure = stationInfo[,"Measure"], Station = i) - data = rbind(data, stationInfo) - } - - #extra step: order by date (would be a DB request) - data = data[order(data[,"Date"]),] - - return (data) -}