collect_asigned_symbols_in_expression: Extracts all the symbols that appear on the left-hand side of...

Description Usage Arguments Details Value Functions

Description

Since R does not require that we declare local variables, and since the variables that are assigned to a local scope depend on the runtime execution of functions, we cannot determine with any certainty which variables will be assigned to in any given scope at any given program point. So the best we can do is figure out which variables are potentially assigned to. Which is what this function does.

Usage

1
2
3
4
collect_assigned_symbols_in_expression(expr, env, params = list(),
  topdown = list())

collect_assigned_symbols_in_function(fun, topdown = list())

Arguments

expr

The expression to analyse

env

Environment in which to look up symbols.

params

Parameters for the function being analysed (if these are needed).

topdown

Information to pass top-down in the traversal.

fun

The function whose body we should analyse

Details

The collect_assigned_symbols_in_function() function reformats the collected data into a character vector, removes duplications, and remove the formal parameters of the function from the list, so those are not considered local variables (rather, they are considered formals and presumably handled elsewhere as such).

Value

A list containing the symbols that were assigned to.

Functions


mailund/foolbox documentation built on Jan. 18, 2022, 10:46 a.m.