get_formals: Get formals of a Function

View source: R/doc.R

get_formalsR Documentation

Get formals of a Function

Description

Returns the arguments of a function from a valid R file.

Usage

get_formals(uri, content, func)

Arguments

uri

Path to R file.

content

R code as string.

func

Function name. If a function is defined multiple times inside the provided file, only the last occurence will be considered.

Value

A named character vector as returned by formals().

Examples

uri <- system.file("testfiles/funcs.R", package = "toscutil")
content <- readLines(uri)
func <- "f2"
if (requireNamespace("languageserver", quietly = TRUE)) {
    get_formals(uri, content, func)
}

toscm/toscutil documentation built on Feb. 23, 2025, 2:20 p.m.