mtcars %>% select(mpg) %>% class()
[1] "data.frame"
Is not the same as:
x <- mtcars %>% select(mpg)
x$mpg %>% class
[1] "numeric"
I have a dplyr chain with several operations. In the end I need the actual content of df$feature, not a data frame with one feature.
Doesn't work:
mtcars %>% select(mpg)$mpg
Error in .$select(mpg) : 3 arguments passed to '$' which requires 2
Is there a way to get the numeric vector mpg within a dplyr chain? So that I don't have to create a variable defined by the dplyr chain, then a new variable df$x like a above. Is it possible to do it in a oner?