View source: R/anlz_splitstorms.R
anlz_splitstorms | R Documentation |
Analyze storm data split by date within years
anlz_splitstorms(
df_hurricane,
date_split,
stats = list(sum = sum, avg = mean, n = length)
)
df_hurricane |
data frame containing date_beg and scale columns for hurricanes |
date_split |
date to split analysis into annual periods |
stats |
list of functions to apply to scale values, default: sum, average and count. Functions should accept numeric vector input and return single value |
A tibble summarizing hurricanes for annual periods "before" and "after" the split date, with requested statistics computed for the scale values
# Create sample hurricane data
hurricanes <- data.frame(
date_beg = as.Date(c(
"1980-07-31", "1980-09-04", "1980-11-07",
"1981-05-06", "1981-08-07", "1981-11-12")),
scale = c(6, 1, 3, 1, 2, 1))
# Basic analysis with default statistics (sum, average and count)
split_date <- Sys.Date() - lubridate::years(1)
anlz_splitstorms(hurricanes, split_date)
# Analysis with custom statistics
anlz_splitstorms(hurricanes, split_date,
stats = list(
max = max,
min = min))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.