Learn R Programming

assertive (version 0.3-0)

assert_is_valid_r_code: Is the input valid R code?

Description

Check to see if the input is a valid (parseable) R code.

Usage

assert_is_valid_r_code(x)

is_valid_r_code(x, .xname = get_name_in_parent(x))

Arguments

x
Input to check.
.xname
Not intended to be used directly.

Value

  • TRUE if the input string is valid R code.

See Also

parse

Examples

Run this code
is_valid_r_code("x <- 1 + sqrt(pi)")
is_valid_r_code("x <- ")
is_valid_r_code("<- 1 + sqrt(pi)")

Run the code above in your browser using DataLab