Description Usage Arguments Author(s) Examples
View source: R/convertExamples.R
Generate example section content from R code.
1 2 | convertExamples(examples_l, captureOutput_b_1n = TRUE,
mode_s_1n = c(NA, "donttest", "dontrun", "dontshow")[1])
|
examples_l |
An unconstrained |
captureOutput_b_1n |
a length-1 or N |
mode_s_1n |
An length-1 or N vector of |
Fabien Gelineau <neonira@gmail.com>
Maintainer: Fabien Gelineau <neonira@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | someComputation <- function(numberAsString_s_1) {
suppressWarnings(sum(as.integer(strsplit(numberAsString_s_1, '')[[1]]), na.rm = TRUE))
}
examples <- list(
function() {
someComputation("145")
},
function() {
someComputation("1547215")
},
function() {
someComputation(NA_character_)
},
function() {
invisible(someComputation("0x145ABC"))
}
)
cat(convertExamples(examples, TRUE , c(NA_character_, 'donttest', 'dontrun', 'dontshow')))
# ------- example 1 -------
# someComputation("145")
# 10
# \\donttest{
# ------- example 2 -------
someComputation("1547215")
# 25
# }
# \\dontrun{
# ------- example 3 -------
# someComputation(NA)
# 0
# }
# \dontshow{
# ------- example 4 -------
#invisible(someComputation("0x145ABC"))
# }"
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.