expand_wildcard: Expand wildcard

View source: R/helpers.R

expand_wildcardR Documentation

Expand wildcard

Description

Expand statement containing wildcard

Usage

expand_wildcard(to_expand, join_by = "|", verbose = TRUE)

Arguments

to_expand

A character vector of length 1L.

join_by

A logical operator. Used to connect causal statements: AND ('&') or OR ('|'). Defaults to '|'.

verbose

Logical. Whether to print expanded query on the console.

Value

A character string with the expanded expression. Wildcard '.' is replaced by 0 and 1.

Examples


# Position of parentheses matters for type of expansion
# In the "global expansion" versions of the entire statement are joined
expand_wildcard('(Y[X=1, M=.] > Y[X=1, M=.])')
# In the "local expansion" versions of indicated parts are joined
expand_wildcard('(Y[X=1, M=.]) > (Y[X=1, M=.])')

# If parentheses are missing global expansion used.
expand_wildcard('Y[X=1, M=.] > Y[X=1, M=.]')

# Expressions not requiring expansion are allowed
expand_wildcard('(Y[X=1])')

CausalQueries documentation built on June 22, 2024, 6:50 p.m.