View source: R/General_Functions.R
getSessions | R Documentation |
This function is useful for createing a unique id for all dives or trips.
getSessions(value, ignore = FALSE, ignoreValue = NULL, maxSession = Inf)
value |
A vector containing the values you want to create IDs for, can be any data type. |
ignore |
Use TRUE if there are values that should not get IDs. |
ignoreValue |
a singe value or list of values to ignore when assigning IDs. |
maxSession |
A numeric value indicating the maximum number of repeating values that should be assigned the same ID. Defaults to Inf for no limit. |
A numeric vector of IDs
# example with numeric input, that ignores 0
tt <- c(0, 0, 1, 1, 1, 1, 3, 3, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 2, 2)
getSessions(value = tt, maxSession = Inf, ignore = TRUE, ignoreValue = 0)
# example with text input
tt <- c('fly', 'fly', 'fly', 'dive', 'dive', 'dive', 'fly', 'fly', 'fly',
'colony', 'colony', 'colony','fly','fly')
getSessions(value = tt, ignore = FALSE)
# example with text input that does not assign ID to colony
getSessions(value = tt, ignore = TRUE, ignoreValue = 'colony')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.