variables: Extract variable names

Description Usage Arguments Methods (by class) See Also Examples

Description

Extract variable names

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
variables(x, ...)

## S4 method for signature 'rule'
variables(x, ...)

## S4 method for signature 'list'
variables(x, ...)

## S4 method for signature 'data.frame'
variables(x, ...)

## S4 method for signature 'environment'
variables(x, ...)

## S4 method for signature 'expressionset'
variables(x, as = c("vector", "matrix", "list"),
  dummy = FALSE, ...)

Arguments

x

An R object

...

Arguments to be passed to other methods.

as

how to return variables:

  • 'vector' Return the uniqe vector of variables occurring in x.

  • 'matrix' Return a boolean matrix, each row representing a rule, each column representing a variable.

  • 'list' Return a named list, each entry containing a character vector with variable names.

dummy

Also retrieve transient variables set with the := operator.

Methods (by class)

  • rule: Retrieve unique variable names

  • list: Alias to names.list

  • data.frame: Alias to names.data.frame

  • environment: Alias to ls

  • expressionset: Variables occuring in x either as a single list, or per rule.

See Also

  • names,expressionset-method, length,expressionset-method

  • description, label, created, origin

Examples

1
2
3
4
5
6
7
8
9
v <- validator(
  root = y := sqrt(x)
 , average = mean(x) > 3
 , sum = x + y == z
)
variables(v)
variables(v,dummy=TRUE)
variables(v,matrix=TRUE)
variables(v,matrix=TRUE,dummy=TRUE)


Search within the validate package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.