R6 class for parsing and evaluating node R expressions.

Share:

Description

This R6 class will parse and evaluate (in the environment of the input data) the node formulas defined by function node. The node formula expressions (stored in exprs_list) are evaluated in the environment of the input data.frame.

Usage

1

Format

An R6Class generator object

Details

  • exprs_list - Deparsed list of node formula expressions (as strings).

  • user.env - Captured user-environment from calls to node that will be used as enclosing environment during evaluation.

  • cur.node - Current evaluation node (set by self$eval.nodeforms())

  • asis.flags - List of flags, TRUE for "as is" node expression evaluation

  • ReplMisVal0 - A logical vector that captures args replaceNAw0=TRUE/FALSE in node function call. If TRUE for a particular node formula in exprs_list then all missing network VarNode values (when nF[i] < Kmax) will get replaced with with corresponding value in codesVar.misXreplace (default is 0).

  • sVar.misXreplace - Replacement values for missing sVar, vector of length(exprs_list).

  • netind_cl - Pointer to a network instance of class simcausal::NetIndClass.

  • Kmax - Maximum number of friends for any observation.

  • Nsamp - Sample size (nrows) of the simulation dataset.

  • node_fun - List that contains special subsetting functions '[' and '[[', where '[' is used for subsetting time-varyng nodes and '[[' is used for subsetting network covariate values.

Methods

new(netind_cl

Instantiates new object of class Define_sVar. netind_cl is the input network stored in an object of class NetIndClass.

set.new.exprs(exprs_list)

Sets the internal node formula expressions to the list provided in exprs_list.

eval.nodeforms(cur.node, data.df)

Evaluate the expressions one by one, returning a list with evaluated expressions. cur.node is the current node object defined with function node and data.df is the input data.frame.

df.names(data.df)

List of variables in the input data data.df gets assigned to a special variable (ANCHOR_ALLVARNMS_VECTOR_0).

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.