View source: R/DiverseFunksjoner.R
DotWrap | R Documentation |
Wrapper when name and value of parameter is the same
DotWrap(fun, dots, ...)
fun |
Function to be called |
dots |
vector of parameternames where value is name |
... |
other parameters |
Funksjon1 <- function(a = 3, b = "Hei", ...) {
cat("a = ", a, "\n")
cat("b = ", b, "\n")
cat("dots = \n")
print(list(...))
}
Funksjon2 <- function(aa = 33, bb = "Heia", ...) {
sys.call()
}
DotWrap("Funksjon1", c("p1", "p2"), a = 15, tull = "tullball")
DotWrap("Funksjon2", c("p1", "p2"), a = 15, tull = "tullball")
DotWrap("Funksjon2", NULL, a = 9) # Use NULL when dots is not in use
DotWrap("Funksjon2", strsplit("par1 par2", split = " ")[[1]], ho = "hoho")
DotWrap("Funksjon2", strsplit("parA;parB;parC", split = ";")[[1]], ho = "hoho", a = 88)
DotWrap("Funksjon1", strsplit("parA;parB;parC", split = ";")[[1]], ho = "hoho", a = 88)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.