get_col_harmonized_scores_df
Source:R/get_col_harmonized_scores_df.R
get_col_harmonized_scores_df.Rd
This function harmonizes liver score data by cleaning column names, replacing missing values with zeros, and optionally rounding specific columns. The function also identifies and harmonizes synonyms, removes unnecessary columns, and reorders the data based on column sums.
Arguments
- liver_score_data_frame
A data frame containing liver score data. This data frame should have column names that may require harmonization.
- Round
A logical value indicating whether the data should be rounded. If TRUE, certain liver-related columns are floored and capped, and histology-related columns are ceiled. Default is FALSE.
Value
A data frame with harmonized liver scores, optional rounding, and columns reordered based on their sums.
Details
The function performs the following operations:
Harmonizes column names by replacing spaces, commas, and slashes with dots.
Replaces missing values (NA) with zero.
Identifies and harmonizes synonym columns, replacing their values with the higher value between the synonyms.
Removes specific unwanted columns such as 'INFILTRATE', 'UNREMARKABLE', 'THIKENING', and 'POSITIVE'.
Optionally rounds liver score columns by flooring and capping them at 5, and histology-related columns by ceiling.
Reorders columns based on the sum of their values.