Is it possible to get a vector or list of variables in an expression?
For instance:
e <- expression(2 * x^2 + y)
The desired output:
('x', 'y')
Is it possible? Or is it necessary to input variable names manually?
Use all.vars
:
all.vars(e)
[1] "x" "y"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With