View source: R/cas_summarise.R
cas_summarise | R Documentation |
cas_count()
Summarise for a given time period word counts, typically calculatd with
cas_count()
cas_summarise(
count_df,
date_column_name = date,
n_column_name = n,
pattern_column_name = pattern,
period = NULL,
f = mean,
period_summary_function = sum,
every = 1L,
before = 0L,
after = 0L,
complete = FALSE,
auto_convert = FALSE
)
count_df |
A data frame. Must include at least a column with a date or date-time column and a column with number of occurrences for the given time. |
period |
Defaults to NULL. A string describing the time unit to be used for summarising. Possible values include "year", "quarter", "month", "day", "hour", "minute", "second", "millisecond". |
f |
Defaults to |
period_summary_function |
Defaults to |
every |
The number of periods to group together. For example, if the period was set to |
before , after |
The number of values before or after the current element to
include in the sliding window. Set to |
complete |
Should the function be evaluated on complete windows only? If |
auto_convert |
Defaults to FALSE. If FALSE, the date column is returned using the same format as the input; the minimun vale in the given group is used for reference (e.g. all values for January 2022 are summarised as 2021-01-01 it the data were originally given as dates.). If TRUE, it tries to adapt the output to the most intuitive correspondent type; for year, a numeric column with only the year number, for quarter in the format 2022.1, for month in the format 2022-01. |
date |
Defaults to |
n |
Unquoted to |
A data frame with two columns: the name of the period, and the same name originally used for n
.
## Not run:
# this assumes dates are provided in a column called date
corpus_df %>%
cas_count(
pattern = "example",
group_by = date
) %>%
cas_summarise(period = "year")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.