elongate: Elongates a pseudo-wide column

Description Usage Arguments Examples

View source: R/elongate.R

Description

Takes a pseudo-wide column and tranform it into a long format

Usage

1
elongate(id, wide, pattern = ";", stringsAsFactors = FALSE, ...)

Arguments

id

a column that will not be splitted

wide

the column to split

pattern

the character or regex used to split up the wide column (see str_split)

stringsAsFactors

should always be FALSE

...

additional parameters for data.frame

Examples

1
2
3
4
5
6
7
8
data(pseudo.wide)
elongated.score <- elongate(pseudo.wide$Protein, pseudo.wide$Score)
elongated.sequence <- elongate(pseudo.wide$Protein, pseudo.wide$Sequence)
# The following works only if the Score and Sequence have the same pattern
# (ie same number of splits per ID)
elongated <- data.frame(Protein = elongated.score$id,
                        Score = elongated.score$wide,
                        Sequence = elongated.sequence$wide)

xrobin/xavamess documentation built on June 15, 2021, 3:46 a.m.