provide: Restrict Variables to a Local Block

Description Usage Arguments Examples

Description

More to come

Usage

1
2
provide(..., .expr = NULL, .exports = NULL, .conditions = NULL,
  .env = parent.frame(), .quiet = FALSE)

Arguments

...

Object definitions and the main expression.

.expr

Expression to evaluate. By default the last element of ...

.exports

List of objects to export. By default taken from everything but the last element of ...

.conditions

List of conditions to check. Usually defined in ...

.env

Environment. Where to provide the objects. By default the environment where the function was executed.

.quiet

Logical. Should the exports be printed to stdout?

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# This provides X and Y. The variables a and beta are not exported
# as they are not specified in ...
provide(
  X = list(dim(X) == c(100,4),
           is.numeric(X)),
  Y,
  NROW(Y)==NROW(X),
  {
    a <- 4

    X <- matrix(rnorm(100*a), ncol=a)
    beta <- rnorm(a)

    Y <- X %*% beta + rnorm(100)
  }
)

STAT-UP/statupinternal documentation built on May 9, 2019, 11:43 a.m.