I would like to pass a variable to the binary operator $.
Let's say I have this
> levels(diamonds$cut)
[1] "Fair" "Good" "Very Good" "Premium" "Ideal"
Then I want to make a function that takes as parameter the selector for $
my_helper <- function (my_param) {
levels(diamonds$my_param)
}
But this doesn't work
> my_helper(cut)
NULL
> my_helper("cut")
NULL