View source: R/anlz_splitdata.R
anlz_splitdata | R Documentation |
Analyze time series data split by date within years
anlz_splitdata(
df,
date_split,
date_col = "date",
value_col = "value",
stats = list(avg = mean)
)
df |
data frame containing date and value columns |
date_split |
date to split analysis into annual periods |
date_col |
name of the date column |
value_col |
name of the value column |
stats |
list of functions to apply to values, default: |
A tibble summarizing data for annual periods "before" and "after" the split date
# Create sample data
data <- data.frame(
date = seq.Date(as.Date("2010-01-01"), as.Date("2020-12-31"), by = "month"),
value = rnorm(132, mean = 10, sd = 2))
# Basic analysis with default statistics
split_date <- as.Date("2015-06-15")
anlz_splitdata(data, split_date, "date", "value")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.