Learn R Programming

mosaic (version 1.9.1)

inferArgs: 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")
)

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.

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

Examples

Run this code
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)) 

Run the code above in your browser using DataLab