Just to add to the other answers, if you would prefer to return a vector rather than a dataframe, you have the following options:
dplyr < 0.7.0
Enclose the dplyr functions in a parentheses and combine it with $
syntax:
(mtcars %>% distinct(cyl))$cyl
dplyr >= 0.7.0
Use the pull
verb:
mtcars %>% distinct(cyl) %>% pull()