expandDups: Expand one entry into multiple lines

View source: R/expandDups.R

expandDupsR Documentation

Expand one entry into multiple lines

Description

Expand one entry, which is separated into different part (which may have different meanings) by a common separator, into multiple lines. Note: this function may destroy your data in some way, since its simply "copy" the rest columns to each entry, so you should be well aware of the meaning of your data.

Usage

expandDups(x, id = 1, sep = ",")

Arguments

x

a data frame or tibble

id

column index of variable needs to expand, which has separators defined as sep. Default the first column.

sep

separator

Author(s)

Yujie Liu

Examples

x <-
  data.frame(
    x1 = c("A,A,A", "B,B", "C"),
    x2 = c(1, 2, 3),
    x3 = c("100,100,200", "200,200", "300")
  )
expandDups(x, id = 1)

liuyujie0136/tinyfuncr documentation built on Dec. 13, 2024, 8:49 a.m.