Extract names from expressions with all.names() and all.vars()
all.names(expression(sin(x+y)))
# [1] "sin" "+" "x" "y"
all.vars(expression(sin(x+y)))
# [1] "x" "y"
The 2 differ from their default values
all.names(expr, functions = TRUE, max.names = -1L, unique = FALSE)
all.vars(expr, functions = FALSE, max.names = -1L, unique = TRUE)