View source: R/events_definition.R
pick_threshold | R Documentation |
An interactive function that calculates and prints the quantiles of the input distribution and asks the user to input the threshold value they want to keep. If a threshold is given as input, then the function checks that the threshold type is correct and returns it. In the swaRmverse framework, the timesteps with lower values than the threshold will be labelled as not part of an event.
pick_threshold(data_distr, var, threshold = NA)
data_distr |
A numeric vector to pick a threshold for. In the package's pipeline it is the timeseries of polarization and average speed of a group. |
var |
A string, the of the distribution to use at the interactive step to ask the user for input. |
threshold |
If NA (the default), the function runs in interactive mode and the user inputs a given value to return. If numeric, the function just returns this input (interactive case is off). |
the selected or input value of the user for the lower threshold, of the variable to be used for the definition of an event.
Marina Papadopoulou m.papadopoulou.rug@gmail.com
define_events
d <- rnorm(25, sd = 1)
d_variable_name <- "a variable"
the_threshold <- 0
pick_threshold(d, d_variable_name, threshold = the_threshold)
## If the threshold is not known, run the interactive version
## without giving a threshold as input.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.