Skip to contents

Function takes a character vector of conditions and returns a list of vectors of predicates. Each element of the list corresponds to one condition. The condition is a string with predicates separated by commas and enclosed in curly braces, as returned by format_condition(). The function splits the condition string into a vector of predicates.

Usage

parse_condition(..., .sort = FALSE)

Arguments

...

character vectors of conditions to be parsed.

.sort

a flag indicating whether to sort the predicates in the result.

Value

a list of vectors of predicates with each element corresponding to one condition.

Details

If multiple vectors of conditions are passed, each of them is processed separately and the result is merged into a single list element-wisely. If the lengths of the vectors are different, the shorter vectors are recycled.

Author

Michal Burda

Examples

parse_condition(c("{a}", "{x=1, z=2, y=3}", "{}"))
#> [[1]]
#> [1] "a"
#> 
#> [[2]]
#> [1] "x=1" "z=2" "y=3"
#> 
#> [[3]]
#> character(0)
#> 
parse_condition(c("{b}", "{x=1, z=2, y=3}", "{q}", "{}"),
                c("{a}", "{v=10, w=11}",    "{}",  "{r,s,t}"))
#> [[1]]
#> [1] "b" "a"
#> 
#> [[2]]
#> [1] "x=1"  "z=2"  "y=3"  "v=10" "w=11"
#> 
#> [[3]]
#> [1] "q"
#> 
#> [[4]]
#> [1] "r" "s" "t"
#>