Normally we don't need these functions. But in case we do, they are flexible in constructing high-order AFL expressions, e.g. AFL raw string or expressions generated in one place and used in other places with or without modification.
e_to_afl()
Convert filter expression(s) to AFL filter; wrapper around scidb::filter_to_afl
e()
Create a list of R expressions; wrapper around scidb::filter
The ... ellipsis arg can include arbitrary expressions, where all names are preserved in their literal forms, except for those prefixed with !! (double exclamation marks) which will be evaluated to their actual values in the calling environment.
Besides common comparison operators including ==
, >
, <
, >=
, <=
, !=
, there are a few special operators
supported to ease AFL generation:
%in%
semantically similar to R. a %in% !!c(1,2,3)
will be translated to (a == 1 or a == 2 or a == 3)
%like%
for string regex matching.
e_merge()
Merge multiple R expressions into one
Merge an ExprsList into a single Expression so that it can be used as a FilterExpr
join_fields()
Join multiple fields with sep = ','
Default behavior: paste(..., sep = sep, collapse = sep)
where sep = ','
afl(...) will convert vectors to joined strings separated by ,
.
This function is useful in concatenating multiple vectors in parallel,
e.g. joining a new field vector and expression vector for the apply
operator.
validate_filter_expr()
Validate a filter expression
Current only report errors on:
Name symbols that are not known schema fields, defined by
param all_fields
Non-atomic R 'values' in the expression