unlist: Flatten list-like objects

Description Usage Arguments Value See Also Examples

Description

Given a list-like object x, unlist produces a vector-like object obtained by concatenating (conceptually thru c) all the top-level elements in x (each of them being expected to be a vector-like object, typically).

NOTE: This man page is for the unlist S4 generic function defined in the BiocGenerics package. See ?base::unlist for the default method (defined in the base package). Bioconductor packages can define specific methods for objects not supported by the default method.

Usage

1
unlist(x, recursive=TRUE, use.names=TRUE)

Arguments

x

A list-like object.

recursive, use.names

See ?base::unlist for a description of these arguments.

Value

See ?base::unlist for the value returned by the default method.

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default method.

See Also

Examples

1
2
3
unlist  # note the dispatch on the 'x' arg only
showMethods("unlist")
selectMethod("unlist", "ANY")  # the default method

Example output

Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit, which, which.max, which.min

function (x, recursive = TRUE, use.names = TRUE) 
{
    if (.Internal(islistfactor(x, recursive))) {
        lv <- unique(.Internal(unlist(lapply(x, levels), recursive, 
            FALSE)))
        nm <- if (use.names) 
            names(.Internal(unlist(x, recursive, use.names)))
        res <- .Internal(unlist(lapply(x, as.character), recursive, 
            FALSE))
        res <- match(res, lv)
        structure(res, levels = lv, names = nm, class = "factor")
    }
    else .Internal(unlist(x, recursive, use.names))
}
<bytecode: 0x1a5e348>
<environment: namespace:base>
Function: unlist (package base)
x="ANY"

Method Definition (Class "internalDispatchMethod"):

function (x, recursive = TRUE, use.names = TRUE) 
.Internal(unlist(x, recursive, use.names))
<environment: base>

Signatures:
        x    
target  "ANY"
defined "ANY"

BiocGenerics documentation built on April 17, 2021, 6:01 p.m.