Learn R Programming

exampletestr (version 1.3.1)

extract_expressions: Text expression groups.

Description

Given a character vector of R expressions, break the vector up into groups of lines, where each group of lines is a valid R expression.

Usage

extract_expressions(text_expr)

Arguments

text_expr

A character vector.

Value

A list of character vectors, each of which can be evaluated as a valid R expression.

Examples

Run this code
# NOT RUN {
text_expr <- c("a <- 1",
               "fx <- function(x) {",
               "  x + 1",
               "}  # this comment will disappear")
extract_expressions(text_expr)
# }

Run the code above in your browser using DataLab