I would like to list all symbols or names used in a call.
I found the following way but surely there is a more idiomatic or efficient approach ?
expr <- quote(a + b * (a / b))
expr <- as.list(expr)
while(!identical(expr, (expr <- unlist(lapply(expr,as.list))))){}
unique(expr)
#> [[1]]
#> `+`
#>
#> [[2]]
#> a
#>
#> [[3]]
#> `*`
#>
#> [[4]]
#> b
#>
#> [[5]]
#> `(`
#>
#> [[6]]
#> `/`
Created on 2019-08-27 by the reprex package (v0.3.0)