Description Usage Arguments Details Value See Also Examples

Functions to compose and-/or-connected logical conditions, based on variable ranges and additional conditions.

1 2 3 | ```
gen.logical.and(.expr, ...)
gen.logical.or(.expr, ...)
``` |

`.expr` |
A base expression which is partially evaluated for all combinations of variables. It may still contain free variables. |

`...` |
Arbitrary many variable ranges and conditions. |

See `gen.list`

for more details on the `.expr`

and `...`

parameters.

For variables with underscores additionally the evaluation of indices in `()`

-brackets is supported. For example, an expression `x_(i+1)`

is evaluated as `x_3`

for `i = 2`

.

Returns an expression `expr_1 & ... & expr_n`

or `expr_1 | ... | expr_n`

where `expr_i`

is generated from `.expr`

,
where all free variables are substituted for which a range is given. The other variables remain untouched.

The generated condition may be used within the the conditions of `gen.list`

and similar functions from this package.

`gen.list`

to generate lists and thereby make use of the generated logical conditions,
and listcompr for an overview of all list comprehension functions.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
# Returns a_1 == 1 & a_2 == 2 & a_3 == 3
gen.logical.and(a_i == i, i = 1:3)
# A data frame of tuples (x_1, x_2, x_3, x_4) summing up to 10 with x_i <= x_(i+1)
gen.data.frame(c(x_1, ..., x_4), x_ = 1:10, x_1 + ... + x_4 == 10,
gen.logical.and(x_i <= x_(i+1), i = 1:3))
# Get all permutations of 1:4
gen.data.frame(c(a_1, ..., a_4), a_ = 1:4,
gen.logical.and(a_i != a_j, i = 1:4, j = (i+1):4))
# Get again the permutations of 1:4, using filter from dplyr
df <- gen.data.frame(c(a_1, ..., a_4), a_ = 1:4)
dplyr::filter(df, !!gen.logical.and(a_i != a_j, i = 1:3, j = (i+1):4))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.