Learn R Programming

funviewR (version 0.1.1)

get_all_expressions: Get all parsed expressions from an R file

Description

Reads an R source file and parses it into a list of expressions. This is a utility function primarily used internally by analyze_internal_dependencies_multi.

Usage

get_all_expressions(file_path)

Value

A list of parsed expressions, or NULL if parsing fails.

Arguments

file_path

Character string. Path to an R file to parse.

Examples

Run this code
# Create a temporary R file
temp_file <- tempfile(fileext = ".R")
writeLines(c(
  "my_function <- function(x) { x + 1 }",
  "another_function <- function(y) { y * 2 }"
), temp_file)

# Parse the file
exprs <- get_all_expressions(temp_file)
if (!is.null(exprs)) {
  print(length(exprs))
}

# Clean up
unlink(temp_file)

Run the code above in your browser using DataLab