composite_score.Rd
The function will perform a row-wise aggregation which then divided by the total number of columns.
composite_score(
data,
cols = dplyr::everything(),
na.rm = FALSE,
composite_col_name = "composited_column"
)
A data.frame or a data.frame extension (e.g. a tibble).
Columns that need to be composited See `dplyr::dplyr_tidy_select` for available options.
Ignore NA. The default is `FALSE`. If set to `TRUE`, the composite score will be `NA` if there is one or more `NA` in any of the columns.
Name for the new composited columns. Default is 'composite_column'.
An object of the same type as .data. The output has the following properties: 1. Columns from .data will be preserved. 2. Columns with composited scores.
test_df = data.frame(col1 = c(1,2,3,4),col2 = c(1,2,3,4), col3 = c(1,2,NA,4))
composite_df = composite_score(data = test_df)