Description Usage Arguments Details Value Note Author(s) See Also Examples
lhs, rhs, op, and op.type
retrieve the various parts of R formulas,
calls, expressions, names/symbols. These functions were designed to
greatly facilitate symbolic manupulation using native R objects. Also
provided are methods to handle list of these objects.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | lhs(x, ...)
## S4 method for signature 'call'
lhs(x)
## S4 method for signature 'formula'
lhs(x)
## S4 method for signature 'expression'
lhs(x, ...)
## S4 method for signature 'list'
lhs(x, ...)
lhs(x) <- value
## S4 replacement method for signature 'call'
lhs(x) <- value
## S4 replacement method for signature 'formula'
lhs(x) <- value
.replace.lhs.plural(x, value)
## S4 replacement method for signature 'expression'
lhs(x) <- value
## S4 replacement method for signature 'list'
lhs(x) <- value
op(x)
## S4 method for signature 'formula'
op(x)
## S4 method for signature 'call'
op(x)
## S4 method for signature 'name'
op(x)
## S4 method for signature 'expression'
op(x)
## S4 method for signature 'list'
op(x)
op(x) <- value
## S4 replacement method for signature 'call'
op(x) <- value
## S4 replacement method for signature 'formula'
op(x) <- value
.replace.op.plural(x, value)
## S4 replacement method for signature 'expression'
op(x) <- value
## S4 replacement method for signature 'list'
op(x) <- value
rhs(x, ...)
.rhs.singular(x)
## S4 method for signature 'call'
rhs(x)
## S4 method for signature 'formula'
rhs(x)
## S4 method for signature 'expression'
rhs(x, ...)
## S4 method for signature 'list'
rhs(x, ...)
rhs(x) <- value
.replace.rhs.singular(x, value)
## S4 replacement method for signature 'call'
rhs(x) <- value
## S4 replacement method for signature 'formula'
rhs(x) <- value
.replace.rhs.plural(x, value)
## S4 replacement method for signature 'expression'
rhs(x) <- value
## S4 replacement method for signature 'list'
rhs(x) <- value
|
x |
object from where to get/set the lhs/rhs |
... |
arguments passed to additional methods |
value |
the value to set for the lhs/rhs |
lhs
retrieves the left-hand side
rhs
retrieves the right-hand side
op
retrieves the operation
op.type
returns the type operator
There are also functions lhs.vars
and rhs.vars
. Like
all.vars
, these functions interpret the variables on the
left-hand and right-hand sides respectively.
These are simple functions for extracting the left-hand side, right-hand side, operator and operator type from formulas, expressions, calls, names/symbols and list containing these objects. lhs, rhs are only defined for formulas and calls ( and list and expressions ) that are defined with either one of the relational or tilde ('~') operators. If the object does not contain one of these operators, it will fail with a warning.
The defined operator types are defined by the operator.tools package: See
operators
and
setOperator
The lhs.vars
and rhs.vars
methods, return the variables used on
the lhs and rhs, respectively. If special formula variables are used, such
as '.', a data.frame or environment must also be provided such that the
variable list may be properly infered.
Value depends on the argument.
Methods for the non-standard "<-
" class exist and are not included in
the usage documentation because CRAN does not support S4 documentation for
this class.
Christopher Brown
terms, all.vars, all.names, operators
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | # FORMULA
f <- A + B ~ C + D
lhs(f)
lhs(f) <- quote( E / F )
rhs(f)
rhs(f) <- quote( G + H )
op(f)
op(rhs(f))
op( quote(A) ) # NULL:
op.type(f)
# ONE-SIDED FORMULA
f <- ~ A #
lhs(f) # NULL
rhs(f) # A
# EXPRESSION
e <- expression( A + B == C + D )
lhs(e)
rhs(e)
op(e)
op.type(e)
# CALL
c <- quote( A + B > C + D )
lhs(c)
lhs(c) <- quote(E)
rhs(c)
op(c)
op.type(c)
# ASSIGNMENT
a <- quote( A <- B )
lhs(a)
rhs(a)
op(a)
op.type(a)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.