View source: R/valid_syntax.R View source: R/utils.R
valid_syntax | R Documentation |
Determine whether a code snippet has any syntax errors.
Determine whether a code snippet has any syntax errors.
valid_syntax(script)
valid_syntax(script)
script |
The code snippet |
Whether the code snippet is valid (can be parsed with parse
)
Whether the code snippet is valid (can be parsed with parse
)
s = "
a = TRUE
b = c(1, 2, 3)
d = function(x) x ^ 2
f = d(b)
"
valid_syntax(s)
#> [1] TRUE
s = "
if (TRUE) {
a = c(1, 2)
"
valid_syntax(s)
#> [1] FALSE
s = "
a = TRUE
b = c(1, 2, 3)
d = function(x) x ^ 2
f = d(b)
"
valid_syntax(s)
#> [1] TRUE
s = "
if (TRUE) {
a = c(1, 2)
"
valid_syntax(s)
#> [1] FALSE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.