collapse_to_atomic: Convert a list to an atomic vector.

View source: R/data_manip_utils.R

collapse_to_atomicR Documentation

Convert a list to an atomic vector.

Description

If x is already an atomc vector, it is not modified. If it is a list, non-scalar elements are converted to scalars, and these are concatenated to produce an atomic vector the same length as x. Specifically, list elements with 0 length are replaced by NA, and elements with length greater than one are pasted together into strings using sep as the separator.

Usage

collapse_to_atomic(x, sep = ",")

Arguments

x

The list to convert.

sep

Separator to use for collapsing vectors to scalars.

Value

An atomic vector that same length and names as x.


DarwinAwardWinner/rctutils documentation built on July 22, 2022, 5:19 a.m.