getNonDefaultArguments: getNonDefaultArguments

View source: R/getNonDefaultArguments.R

getNonDefaultArgumentsR Documentation

getNonDefaultArguments

Description

Given a function and an argument list, identify which arguments are different from their default.

Usage

getNonDefaultArguments(functionName, args, errorOnMismatch = TRUE)

Arguments

functionName

A function name as a string (usually in the form package:::fun, e.g. madrat:::calcTauTotal). Passing a vector of functions is possible, but is only intended for corresponding read/correct/convert functions. If multiple functions in a vector define arguments with the same name but different default values only the default defined in the first function is considered.

args

A list of named arguments used to call the given function(s). If duplicates of arguments exists the first occurrence of the argument will be used.

errorOnMismatch

Whether an error is thrown in case an argument in args is not accepted by functionName.

Value

A subset of args that is used by the function/s and is different from default values.

Author(s)

Jan Philipp Dietrich, Pascal Sauer

See Also

cacheArgumentsHash, toolstartmessage

Examples

madrat:::getNonDefaultArguments("madrat:::readTau", args = list(subtype = "historical"))
madrat:::getNonDefaultArguments("madrat:::readTau", args = list(subtype = "paper"))
functionNames <- c(madrat:::readTau, madrat:::convertTau)
madrat:::getNonDefaultArguments(functionNames, args = list(subtype = "historical"))

pik-piam/madrat documentation built on July 4, 2025, 4:56 a.m.