## = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ## This is a self-contained R script generated from an RSP document. ## It may be evaluated using source() as is. ## = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ## Local RSP utility functions ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ## RSP metadata function .rmeta <- list( ) rmeta <- function(...) { args <- list(...) if (length(args) == 0) return(.rmeta) names <- names(args) if (length(names) > 0) { for (name in names) .rmeta[[name]] <<- args[[name]] } else { names <- unlist(args, use.names=FALSE) if (length(names) == 1) .rmeta[[names]] else .rmeta[names] } } ## Look up 'base' function once (faster) if (getRversion() < "2.15.0") { .base_paste <- base::paste .base_paste0 <- function(...) .base_paste(..., sep="") } else { .base_paste0 <- base::paste0 } .base_cat <- base::cat ## RSP output function .rout <- function(x) .base_cat(.base_paste0(x)) ## RSP output function for inline RSP constructs .rout0 <- function(x) .base_cat(rpaste(x)) ## The output of inline RSP constructs is controlled by ## generic function rpaste(). rpaste <- function(...) UseMethod("rpaste") setInlineRsp <- function(class, fun, envir=parent.frame()) { name <- sprintf("rpaste.%s", class) assign(name, fun, envir=envir) ## FIXME: How to register an S3 method at run-time? /HB 2018-04-06 ## registerS3method("rpaste", class = class, method = name, envir = envir) } ## The default is to coerce to character and collapse without ## a separator. It is possible to override the default in an ## RSP code expression. setInlineRsp("default", function(x, ...) .base_paste0(x, collapse="")) ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ## RSP source code script [BEGIN] ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .rout("Page size: a4paper\n\n# Attribute values\n\n## Regular quotation marks\na=[abc]\na=[abc]\n\n### Empty values\na=[]\na=[]\n\n### Mixed quotation marks\na=[\"abc\"]\na=['abc']\n\n### Escaping quotation marks\na=[\\'abc]\na=[abc\\']\na=[\\\"abc\\\"]\na=[\\'abc\\']\n\n## Paired symbols of any kind\na=[abc]\na=[abc]\na=[abc]\n\n## Paired brackets\n\n### Single paired brackets\na=[abc]\na=[abc]\na=[abc]\na=[abc]\n\n### Multiple paired brackets\na=[abc]\na=[abc]\na=[abc]\na=[abc]\n\n### Lots of paired brackets\na=[abc]\n\n### Escaping closing bracket\na=[abc\\}]\na=[abc\\}]\na=[abc\\>]\n\n### Empty values\na=[]\na=[]\na=[]\na=[]\n") ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ## RSP source code script [END] ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -