Accepts a data frame containing raw data and calculates performance indices using a user-defined function.
Usage
preproc_data(
data,
fn,
...,
col_raw_parsed = "raw_parsed",
pivot_results = TRUE,
pivot_names_to = "index_name",
pivot_values_to = "score"
)
Arguments
- data
A data.frame contains raw data.
- fn
This can be a function or formula. See
rlang::as_function()
for more details.- ...
Additional arguments passed to
fn
.- col_raw_parsed
The column name in which stores user's raw data in format of a list of data.frames.
- pivot_results
Whether to pivot the calculated indices. If
TRUE
, the calculated indices are pivoted into long format, with each index name stored in the column ofpivot_names_to
, and each index value stored in the column ofpivot_values_to
. IfFALSE
, the calculated indices are stored in the same format as returned byfn
.- pivot_names_to, pivot_values_to
The column names used to store index names and values if
pivot_results
isTRUE
. Seetidyr::pivot_longer()
for more details.
Value
A data.frame contains the calculated indices.