Learn R Programming

xfun (version 0.33)

split_source: Split source lines into complete expressions

Description

Parse the lines of code one by one to find complete expressions in the code, and put them in a list.

Usage

split_source(x)

Value

A list of character vectors, and each vector contains a complete R expression.

Arguments

x

A character vector of R source code.

Examples

Run this code
xfun::split_source(c("if (TRUE) {", "1 + 1", "}", "print(1:5)"))

Run the code above in your browser using DataLab