sessionVariable: Create a session variable in an environment.

Description Usage Arguments Value Author(s) Examples

Description

Session variables are typically only set once per R session. They include items such as user login and password for motus.org They are implemented as active bindings in an environment. If the binding's current value is NULL, the user is prompted to enter the value.

Usage

1
2
sessionVariable(name, info = name, env = Motus, class = "character",
  val = NULL)

Arguments

name

name of variable

info

human-readable description of the variable. This is used to prompt the user if the value of the variable is not already known.

Alternatively, this can be an R function to be called the first time the value needs to be obtained. That function will presumably depend on other session variables. The function should return the value of the variable (or generate an error if not successful).

env

environment in which to create the session variable Default: Motus

class

the class of the variable desired; when the user is prompted for it, the value is coerced to this class. Default: "character"

val

initial value of the session variable. Default: unset.

Value

a function which can be installed as an active binding in an environment

Author(s)

John Brzustowski jbrzusto@REMOVE_THIS_PART_fastmail.fm

Examples

1
2
3
4
5
 sessionVariable("userLogin", "user login at motus.org")

## This creates an active binding for the symbol "userLogin" in the environment "Motus"
## If the variable \code{Motus$userLogin} is requested in code, the user will
## be prompted to enter a value if there is no current value.

jbrzusto/motusClient documentation built on May 30, 2019, 4:33 p.m.