DotWrap: Wrapper when name and value of parameter is the same

View source: R/DiverseFunksjoner.R

DotWrapR Documentation

Wrapper when name and value of parameter is the same

Description

Wrapper when name and value of parameter is the same

Usage

DotWrap(fun, dots, ...)

Arguments

fun

Function to be called

dots

vector of parameternames where value is name

...

other parameters

Examples


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)


statisticsnorway/Kostra documentation built on Nov. 2, 2024, 6:40 p.m.