View source: R/parse_results.R
queryToExpr | R Documentation |
The function takes a list of condition rules provided by the widget (input[[<widget-name>]]
) and
returns valid R expression that can be used for example in filter function.
queryToExpr(query, keep_na = FALSE, .queryBuilderConfig = queryBuilderConfig)
query |
Query definition (see queryRule and queryGroup). |
keep_na |
Should query keep or exclude missing values? |
.queryBuilderConfig |
R6 class object storing query configuration. See queryBuilderConfigClass. |
Object of class 'call'. A filtering expression that can be passed to 'dplyr'-based filtering methods.
query <- queryGroup(
condition = "AND",
queryGroup(
queryRule(
field = "Species",
operator = "equal",
value = "setosa"
),
queryRule(
field = "Petal.Length",
operator = "less",
value = 1.2
)
)
)
queryToExpr(query)
dplyr::filter(iris, !!queryToExpr(query))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.