| ASTVariable | R Documentation |
A Variable in an Abstract Syntax Tree (AST)
A Variable in an Abstract Syntax Tree (AST)
R6Class object.
This node represents a variable of interest in the AST. A variable's name
is recorded in the value field, and must conform to the rules of identifiers
in R. This class inherits from ASTNode.
new(identifier, format=NA, type=NA)terms()Returns the node
distribute()Applies the distributive property to the node, and returns the resulting node.
string()Returns the string formula of the node
name()Return a human representation of a node
reduce(data)Given a set of data, perform the logical reduction of the current node.
tangram::ASTNode -> ASTVariable
dataThe associated data post reduction
typeThe identified type of this node (defaults: Categorical, Numeric)
new()This method creates an AST node representing a variable of a given identifier. An optional format consisting of a string of a number or a c-style printf string. An option type denoting a forced type cast of that variable.
ASTVariable$new(identifier, format = NA, type = NA)
identifier(character) Variable name
format(character, numeric) Formatting directive
type(character) any additional type information
factors()Returns all terminal nodes under this. Since this is a terminal node, returns self
ASTVariable$factors()
name()Returns the text name of this node. For an intercept, returns "All"
ASTVariable$name()
string()Returns name of variable with optional format and type information
ASTVariable$string()
reduce()Given a data.frame, associates correct variable with this node
ASTVariable$reduce(d)
d(data.frame) data.frame to reduce
clone()The objects of this class are cloneable with this method.
ASTVariable$clone(deep = FALSE)
deepWhether to make a deep clone.
ASTVariable$new("x", "2", "Continuous")$string()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.