Aliases: parse_expr parse_exprs parse_quo parse_quos
Keywords:
### ** Examples # parse_expr() can parse any R expression: parse_expr("mtcars %>% dplyr::mutate(cyl_prime = cyl / sd(cyl))")
mtcars %>% dplyr::mutate(cyl_prime = cyl/sd(cyl))
# A string can contain several expressions separated by ; or \n parse_exprs("NULL; list()\n foo(bar)")
[[1]] NULL [[2]] list() [[3]] foo(bar)
# Use names to figure out which input produced an expression: parse_exprs(c(foo = "1; 2", bar = "3"))
$foo [1] 1 $foo [1] 2 $bar [1] 3
# You can also parse source files by passing a R connection. Let's # create a file containing R code: path <- tempfile("my-file.R") cat("1; 2; mtcars", file = path) # We can now parse it by supplying a connection: parse_exprs(file(path))
[[1]] [1] 1 [[2]] [1] 2 [[3]] mtcars