extra_attrs_to_cols: New columns from extra attributes

extra_attrs_to_colsR Documentation

New columns from extra attributes

Description

New columns from extra attributes

Usage

extra_attrs_to_cols(data, ..., flatten = FALSE, keep_empty = TRUE)

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

See Also

  • extra_attrs

  • has_extra_attrs

  • with_extra_attrs

  • filter_extra_attrs

  • extra_attr_values

Examples

i <- import_omnipath_interactions(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
)


saezlab/OmnipathR documentation built on May 3, 2024, 5:32 a.m.