Skip to content

Commit

Permalink
plotTZ : rename mean by areas -> by variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Benoit Thieurmel committed Sep 29, 2021
1 parent 8a50576 commit 501f34d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
#' @param aggregate
#' When multiple elements are selected, should the data be aggregated. If
#' "none", each element is represented separetly. If "mean" values are
#' averaged and if "sum" they are added. You can also compute mean ans sum by areas.
#' averaged and if "sum" they are added. You can also compute mean and sum by variable.
#' @param colors
#' Vector of colors
#' @param ylab
Expand Down Expand Up @@ -193,7 +193,7 @@ tsPlot <- function(x,
confInt = 0,
minValue = NULL,
maxValue = NULL,
aggregate = c("none", "mean", "sum", "mean by areas", "sum by areas"),
aggregate = c("none", "mean", "sum", "mean by variable", "sum by variable"),
compare = NULL,
compareOpts = list(),
interactive = getInteractivity(),
Expand Down Expand Up @@ -818,12 +818,12 @@ tsPlot <- function(x,
),

aggregate = mwSelect({
tmp <- c("none", "mean", "sum", "mean by areas", "sum by areas")
tmp <- c("none", "mean", "sum", "mean by variable", "sum by variable")
names(tmp) <- c(.getLabelLanguage("none", language),
.getLabelLanguage("mean", language),
.getLabelLanguage("sum", language),
.getLabelLanguage("mean by areas", language),
.getLabelLanguage("sum by areas", language))
.getLabelLanguage("mean by variable", language),
.getLabelLanguage("sum by variable", language))
tmp
}, value ={
if(.initial) aggregate
Expand Down
8 changes: 4 additions & 4 deletions R/plot_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
.getTSData <- function(x, tpl, variable, elements,
uniqueElement = unique(tpl$element),
mcYear = NULL,
dateRange = NULL, aggregate = c("none", "mean", "sum", "mean by areas", "sum by areas"),
dateRange = NULL, aggregate = c("none", "mean", "sum", "mean by variable", "sum by variable"),
typeConfInt = FALSE) {

if (length(variable) == 0){return(tpl[0])}
Expand All @@ -43,7 +43,7 @@
tpl <- rbindlist(listVar)
elements <- as.vector(sapply(elements, function(X){paste(X, "__", variable)}))
}else{
if (aggregate %in% c("mean by areas", "sum by areas")){
if (aggregate %in% c("mean by variable", "sum by variable")){
tpl <- listVar[[1]][, element := paste(element, "__", names(listVar)[1])]
elements <- paste(elements, "__", variable)
} else {
Expand Down Expand Up @@ -87,14 +87,14 @@
tpl <- tpl[, .(element = as.factor("Sum"), value = sum(value)),
by = c(.idCols(tpl))]
}
} else if (aggregate == "mean by areas"){
} else if (aggregate == "mean by variable"){

tpl$areas <- unlist(lapply(strsplit(tpl$element, "__"), function(X) X[1]))
tpl$element <- unlist(lapply(strsplit(tpl$element, "__"), function(X) X[2]))

tpl <- tpl[, .(value = mean(value)),
by = c(.idCols(tpl), "element")]
} else if (aggregate == "sum by areas"){
} else if (aggregate == "sum by variable"){

tpl$areas <- unlist(lapply(strsplit(tpl$element, "__"), function(X) X[1]))
tpl$element <- unlist(lapply(strsplit(tpl$element, "__"), function(X) X[2]))
Expand Down
4 changes: 2 additions & 2 deletions inst/language_labels.csv
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ aggregate;Agrégation
none;sans
mean;moyenne
sum;somme
mean by areas;moyenne par nœud
sum by areas;somme par nœud
mean by variable;moyenne par variable
sum by variable;somme par variable
highlight;Surbrillance
Color;Couleur
Size;Taille
Expand Down
10 changes: 5 additions & 5 deletions man/tsPlot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 501f34d

Please sign in to comment.