Define_sVar: R6 class for parsing and evaluating node R expressions.

Description Usage Format Details Methods


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.




An R6Class generator object


  • 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.



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

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.


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

Search within the tmlenet package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.