View source: R/get_index_limits.R
get_index_limits | R Documentation |
data.frame
or data.tableConvenient function to get the index limits of a data.table
with a variable called index
. This function is especially useful to extend the axis limits of a 'ggplot' using the min.extend
and max.extend
arguments of this function.
get_index_limits(.data, min.extend = 0, max.extend = 0)
.data |
a |
min.extend |
how much to extend the limits relative to the minimum |
max.extend |
how much to extend the limits relative to the maximum |
a numeric vector of length 2, where the first element is the minimum and the second element is the maximum
DT <- data.table(index = as.Date(c("2010-01-01", "2015-01-01", "2021-01-01")))
get_index_limits(DT)
get_index_limits(DT, max.extend = 365)
get_index_limits(DT, min.extend = 365)
get_index_limits(DT, min.extend = -365)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.