s2c: String to call

Description Usage Arguments Details Value

View source: R/helperMisc.R

Description

Convert a character vector to a call of the desired class

Usage

1
s2c(x, type = "list")

Arguments

x

a character string (e.g., of column names in a data.table)

type

the class resulting from the evaluation of the call returned by s2c

Details

e.g., convert c("column1","column2") to list(column1, column2) intended for use in a data.table (see data.table)

Value

a list

@examples library(data.table) first <- data.table(cray=sample(letters,4),"one"=c(1,2,3,4), "two"=c(1,3,5,7)) second <- data.table("cray"=sample(letters,35, TRUE)) oc <- CJ(one=first[,(one)], cray=second[[1]]) sub <- s2c(c("one","cray")) oc[,eval(sub)]


rBatt/trawlData documentation built on June 30, 2017, 12:59 p.m.