reso_validate: Validate a 'reso' expression.

Description Usage Arguments Value Examples

View source: R/reso_validate.R

Description

Tests whether a string or file is an R expression. Fails with error if the string or file is invalid and soft=FALSE, returns FALSE is the file is invalid while soft=TRUE.

Usage

1

Arguments

file

string. either a path to a file or a reso expression as a string.

soft

logical. Should reso_validate() return FALSE instead of failing on error if a file is invalid? FALSE by default.

Value

TRUE if the file is a valid reso expression, FALSE otherwise.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
reso_validate("assign(a, b)") # these two fail with error
reso_validate("x(s(d(p()))) + a")

## End(Not run)

reso_validate("assign(a, b)", soft = TRUE) #is invalid, but
# soft=TRUE prevents error and the function returns FALSE instead
reso_validate("x(s(d(p()[0])))") # these two are valid code
reso_validate("x(s(d(p()[0])))(0,x(s(d(p()[0])))(!0,0[0]))")

18kimn/reso documentation built on Dec. 17, 2021, 5:28 a.m.