get_quantiles {SeaVal} | R Documentation |
Calculate quantiles from a data table
Description
The quantiles are saved in/returned as a list with the following elements:
dt - A data table with quantiles for each level of by (not the same as the input-dt).
quantiles - the vector of quantiles that were used.
group - a data table containing the levels the quantiles are grouped over, e.g. all years the quantiles are calculated over.
data_col_name - the name of data_col, see below, so that you know what the quantiles actually were computed from.
description - the description string, if provided.
Usage
get_quantiles(
dt,
data_col = setdiff(names(dt), dimvars(dt))[1],
qqs = c(10, 20, 33, 67, 80, 90),
by = setdiff(dimvars(dt), c("year", "member")),
description = NULL,
save_file = NULL
)
Arguments
dt |
Data table containing the data. |
data_col |
The name of the column in dt containing the data for which the quantiles are derived. By default the first column that is not a dimension variable is selected. |
qqs |
Vector of quantiles. If one of them is larger 1 they are interpreted as percent. Default is the quantiles used in the verification maps. |
by |
Column names in dt. Levels by which the quantiles are calculated |
description |
Optional description string. |
save_file |
Optional name of save file. |
Value
Nothing if save_file is provided. Otherwise the list described above
Examples
get_quantiles(chirps_monthly)