inferArgs {mosaic}R Documentation

Infer arguments

Description

The primary purpose is for inferring argument settings from names derived from variables occurring in a formula. For example, the default use is to infer limits for variables without having to call them xlim and ylim when the variables in the formula have other names. Other uses could easily be devised by specifying different variants.

Usage

inferArgs(
  vars,
  dots,
  defaults = alist(xlim = , ylim = , zlim = ),
  variants = c(".lim", "lim")
)

Arguments

vars

a vector of variable names to look for

dots

a named list of argument values

defaults

named list or alist of default values for limits

variants

a vector of optional postfixes for limit-specifying variable names

Value

a named list or alist of limits. The names are determined by the names in defaults.

If multiple variants are matched, the first is used.

Examples

inferArgs(c('x','u','t'), list(t=c(1,3), x.lim=c(1,10), u=c(1,3), u.lim=c(2,4)))
inferArgs(c('x','u'), list(u=c(1,3)), defaults=list(xlim=c(0,1), ylim=NULL)) 

[Package mosaic version 1.9.1 Index]