Learn R Programming

textTools (version 0.1.0)

str_dt_col_combine: Combine columns of a data.table into a list in a new column, wraps list(unlist(c(...)))

Description

Combine columns of a data.table into a list in a new column, wraps list(unlist(c(...)))

Usage

str_dt_col_combine(...)

Arguments

...

Unquoted column names of a data.table.

Value

A list, with columns combined into a vector if grouped properly

Examples

Run this code
# NOT RUN {
as.data.table(
list(
  col1 = c(
    "a",
    "b"
  ),
  col2 = c(
    tolower("The dog is nice because it picked up the newspaper."),
    tolower("The dog is extremely nice because it does the dishes.")
  ),
  col3 = c(
    "test 1",
    "test 2"
  )
)
)[, col4 := .(str_dt_col_combine(col2, col3)), col1]
# }

Run the code above in your browser using DataLab