New columns from extra attributes
Arguments
- data
An interaction data frame.
- ...
The names of the extra attributes; NSE is supported. Custom column names can be provided as argument names.
- flatten
Logical: unnest the list column even if some records have multiple values for the attributes; these will yield multiple records in the resulted data frame.
- keep_empty
Logical: if `flatten` is `TRUE`, shall we keep the records which do not have the attribute?
Value
Data frame with the new column created; the new column is list type if one interaction might have multiple values of the attribute, or character type if
Examples
i <- omnipath(fields = "extra_attrs")
extra_attrs_to_cols(i, Cellinker_type, Macrophage_type)
extra_attrs_to_cols(
i,
Cellinker_type,
Macrophage_type,
flatten = TRUE,
keep_empty = FALSE
)