melt_map: convert a "wide" map into a "long" one

Description Usage Arguments Value See Also Examples

View source: R/mapping.R

Description

convert a "wide" map into a "long" one

Usage

1
melt_map(df, id, measure, sep_pattern = NA)

Arguments

df

tibble. rows containing NA in any of following variables are removed.

id

string. name of a character variable in df, its elements must be unique and can only contain one value each

measure

string. name of a character variable in df, its elements needn't to be unique and contain multiple values (we use stringr::str_split() to sperate them by sep_pattern)

sep_pattern

string. see measure, note that it is a pattern, for example, '|' should be '\|'

Value

tibble. column names are id and measure.

See Also

Other mapping: cast_map()

Examples

1
2
3
4
5
6
tibble::tribble(
    ~symbol, ~id, ~foobar,
    'A|B', '1', 'foo',
    'C', '2', 'bar',
    'D', '2', 'foobar'
) %>% melt_map('id', 'symbol', '\\|')

dongzhuoer/hgnc documentation built on Aug. 7, 2020, 8:39 a.m.