Learn R Programming

sdbuildR (version 2.0.0)

maybe_wrap: Conditionally wrap a result string in parentheses

Description

Used by infix operators to add parens when the current operator has lower precedence than the parent context.

Usage

maybe_wrap(result, current_op, parent_op)

Value

Possibly parenthesized string

Arguments

result

The human-readable string for this sub-expression

current_op

The current operator

parent_op

The parent operator (from the recursive call)