unnest2: Unnest a single list-column into expanded rows

unnest2R Documentation

Unnest a single list-column into expanded rows

Description

Unnest a single list-column into expanded rows

Usage

unnest2(object, ...)

## S4 method for signature 'DFrame'
unnest2(object, col)

Arguments

object

Object.

col

character(1). Name of the list-column to unnest into long format.

...

Additional arguments.

Value

Modified object, with a single unnested list-column expanded into rows.

Note

Updated 2023-08-25.

See Also

  • tidyr::unnest().

Examples

## DFrame ====
suppressPackageStartupMessages({
    library(IRanges)
    library(pipette)
})
object <- as.DataFrame(list(
    "col1" = CharacterList(
        c("a", "b", "c", "d"),
        c("e", "f", "g"),
        c("h", "i")
    ),
    "col2" = IntegerList(
        seq(from = 1L, to = 2L),
        seq(from = 3L, to = 4L),
        seq(from = 5L, to = 6L)
    ),
    "col3" = c("a", "b", "c")
))
print(object)
x <- unnest2(object, col = "col1")
print(x)
y <- unnest2(object, col = "col2")
print(y)

acidgenomics/r-acidplyr documentation built on July 4, 2025, 5:55 a.m.