This function takes in a data frame and collapses the provided strain and percentage columns using a semicolon (;).
The individual strains and percentages in each row are combined into single, semicolon-separated strings.
This is commonly used after manipulating or analyzing strains and their corresponding compositions.
Usage
collapse_and_nest_columns(
user_data,
row_number_col,
strains_col,
percentage_col
)
Arguments
- user_data
A data frame with the specified strain and percentage columns.
- strains_col
The column name in the data frame containing strain data.
- percentage_col
The column name in the data frame containing percentage data.
Value
A data frame with nested strain and percentage columns.
Examples
if (FALSE) { # \dontrun{
result <- collapse_and_nest_columns(df, "strain_column_name", "percentage_column_name")
} # }