Learn R Programming

RWsearch (version 4.6)

cnsc: Conversion of Non-Standard Content into a Character Chain

Description

cnsc converts standard content and non-standard content ... into a character chain. Standard content, including calls, is evaluated. Non-standard content and non-existing objects (in .GlobalEnv) are converted into character chains. Regular lists are kept unchanged.

cnscinfun is intended to be used inside a function. It should not be used directly.

Usage

cnsc(...)

cnscinfun()

cnscinfun2(...)

Arguments

...

Character vectors, standard or non-standard, existing or non-existing R objects, regular call. Examples : "word1"; c("word1 word2"); c("word1", "word2"); "word1", "word2", "word3"; word1, word2, c("word3", "word4").

Examples

Run this code
# NOT RUN {
### cnsc
## Non-standard content (nsc1, nsc2), standard content ("stc3", "double word4") 
## and regular object (vec) stored in .GlobalEnv are merged.
vec <- c("obj5", "obj6")
cnsc(nsc1, nsc2, "stc3", "double word4", vec)

## Lists, either name in .GlobalEnv or call, are evaluated.
lst <- list(A = c("txt1","txt2","txt3"), B = c("txt4", "txt5"))
cnsc(lst) 
cnsc(list(C = c("pkg1","pkg2","pkg3"), D = c("pkg4","pkg5")))

### cnscinfun
fun <- function(...) cnscinfun()
fun(nsc1, nsc2, "stc3", "double word4", vec) 
fun(lst)

# }

Run the code above in your browser using DataLab