
Process variable of interest from Pandemic PACT website data by a grouping variable
Source:R/pact_process.R
pact_process.Rd
Process variable of interest from Pandemic PACT website data by a grouping variable
Usage
pact_process_topic_group(
pact_data_list_cols,
topic,
group = NULL,
outcome = c("frequency", "money"),
na_values = NULL
)
pact_process_disease(
pact_data_list_cols,
group = NULL,
outcome = c("frequency", "money")
)
pact_process_category(
pact_data_list_cols,
topic = c("ResearchCat", "ResearchSubcat"),
split_grants = TRUE,
outcome = c("frequency", "money")
)
Arguments
- pact_data_list_cols
A data.frame for the Pandemic PACT dataset read from the Pandemic PACT website that has already been pre-processed to have list columns for nested variables. This is usually obtained via a call to
pact_process_website()
withcol_list = TRUE
.- topic
A character value of the variable name in
pact_data
for the topic of interest.- group
A character value or vector of up to two values of the variable name/s in
pact_data
to use as grouping variable/s. When specified as NULL (default), no grouping is applied to come up with value ofoutcome
based on thetopic
of interest.- outcome
The type of outcome. Either "frequency" or "money". Default is "frequency".
- na_values
A character value or vector of values for strings to be considered as NA for
topic
andgroup
. If NULL (default),topic
andgroup
are kept as is.- split_grants
Logical. Should grants be divided into those with specified or unspecified amount of funding. Default to TRUE.
Value
A data.frame structured based on specification. If group
is NULL,
the data.frame presents values for topic
as first column and then either
frequencies/counts of grants per topic
value or sum of monetary amount of
grants per topic
. if group
has one value, the data.frame presents
values for group
as first column followed by either frequencies/counts
of grants per group
or sum of monetary amount of grants per group
then
followed by the topics
within each group
followed by either
frequencies/counts of grants per topic
by group
or sum of monetary
amount of grants per topic
by group
.
Examples
if (FALSE) { # \dontrun{
df <- pact_read_website() |> pact_process_website()
pact_process_topic_group(df, topic = "Disease")
} # }