splatnd {cgwtools}R Documentation

Execute simple zero-argument functions

Description

Execute simple zero-argument functions without having to type the "()" , and without having to go through the bother of makeActiveBinding. This code is provided primarily to allow the user to build his own set of command "shortcuts" by modifying the set of arguments to the switch function in the function body. The bulk of the code is copied from the excellent package sos . The name splatnd cannot be called directly, and doesn't even exist after being sourced. It serves to define a variety of operators ![your_string_here] . If the string after ! is not in the switch-list, the function defaults to the normal splat operator, i.e. NOT[your_string_here] .

Arguments

none

Details

The strings supported, with their associated functions, as delivered are: 'newdev' = dev.new(width=4.5, height= 4.5, restoreConsole=T), 'qapla' = cat('batlh tIn chav'), 'quitn' = quit('no'), 'quity' = quit('yes'), There's an obvious risk of undesired results should there exist an object in the environment with the same name as one of the items in the switch options. The workaround is to enclose the object name in parentheses. See the example.

Value

The returned value is the result of whatever function or operator was invoked.

Note

The bulk of the code is taken directly from the sos package.

Author(s)

Carl Witthoft, carl@witthoft.com

See Also

The R manuals on creating operators, findFn in the package sos , normally invoked as ???

Examples

# based on the default items in splatnd.R
qapla <- 1:5
!qapla
!(qapla)

[Package cgwtools version 4.1 Index]