# 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)
### cnscinfun used in RWsearch: one line at the begining of each function.
### An easy-to-use Non Standard Evaluation, mainly for characters.
funsort <- function(..., char = NULL) {
words <- if (is.null(char)) cnscinfun() else char
sort(words)
# or more complex code
}
funsort(nsc1, nsc2, "stc3", "double word4", vec)
funsort(char = sample(vec, 5, replace = TRUE))
# }
Run the code above in your browser using DataLab