Skip to contents

All the different elements of an expression are replaced with nomalised names that represent their types, such as: "SYMBOL", "NUM_CONST"

Usage

normalise_expression(x, collapse = " ")

Arguments

x

an expression as returned by parse or a vector of character representing the text to be parsed

collapse

separator string to be put between the single tokens into which the expression is split. The default is the space character " ".

Value

vector of character of length one with attribute "text"

Examples

normalised_1 <- normalise_expression("x + 1")
normalised_2 <- normalise_expression("y + 2")

# Use c() to remove the attributes
identical(c(normalised_1), c(normalised_2))
#> [1] TRUE