expandColumn: Expand a column of vectors into one row per value of each...

Description Usage Arguments Value Examples

View source: R/expandColumn.R

Description

Similar to tidyr::unnest but lands rowids and value ids, and can work on remote data sources. Fairly expensive per-row operation, not suitable for big data.

Usage

1
2
3
4
5
6
7
8
9
expandColumn(
  data,
  colName,
  ...,
  rowidSource = NULL,
  rowidDest = NULL,
  idxDest = NULL,
  tempNameGenerator = mk_tmp_name_source("replyr_expandColumn")
)

Arguments

data

data.frame to work with.

colName

character name of column to expand.

...

force later arguments to be bound by name

rowidSource

optional character name of column to take row indices from (rowidDest must be NULL to use this).

rowidDest

optional character name of column to write row indices to (must not be an existing column name, rowidSource must be NULL to use this).

idxDest

optional character name of column to write value indices to (must not be an existing column name).

tempNameGenerator

temp name generator produced by wrapr::mk_tmp_name_source, used to record dplyr::compute() effects.

Value

expanded data frame where each value of colName column is in a new row.

Examples

1
2
3
4
5
d <- data.frame(name= c('a','b'))
d$value <- list(c('x','y'),'z')
expandColumn(d, 'value',
             rowidDest= 'origRowId',
             idxDest= 'valueIndex')

WinVector/replyr documentation built on Oct. 22, 2020, 8:07 p.m.