pasteCols {toolbox}R Documentation

Paste together columns of a list/data frame

Description

Paste together columns of a list/data frame

Usage

pasteCols(
  x,
  sep = " ",
  collapse = NULL,
  use_paste0 = FALSE,
  cols = NULL,
  by_name = FALSE
)

Arguments

x

A list or data frame.

sep

A character sting to separate the terms.

collapse

An optional character string to separate the results.

use_paste0

Boolean, if TRUE, will call paste0 instead of paste.

cols

An optional vector of column positions or names to paste together. If passing column names, set by_name to TRUE. The order of items in cols determines the order of the paste result.

by_name

Boolean, if TRUE, it quotes the items in cols to properly index the list by name (x[[1]] vs x[["col_a"]]).

Value

A string with the values in each column pasted together.

Examples

pasteCols(list("x" = c(1, 2, 3), "y" = c("a", "b", "c")))

[Package toolbox version 0.1.1 Index]