Skip to content

Instantly share code, notes, and snippets.

@earino
Created November 18, 2014 01:46
Show Gist options
  • Save earino/022b9e4273d465c70354 to your computer and use it in GitHub Desktop.
Save earino/022b9e4273d465c70354 to your computer and use it in GitHub Desktop.
tbl_df drops?
> tbl_df(iris) %>% class()
[1] "tbl_df" "tbl" "data.frame"
> tbl_df(iris) %>% filter(Species == "setosa") %>% class()
[1] "tbl_df" "tbl" "data.frame"
> tbl_df(iris) %>% filter(Species == "setosa") %>% .[,"Species"] %>% class()
[1] "factor"
> tbl_df(iris) %>% filter(Species == "setosa") %>% .[,"Species"] %>% str()
Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ...
@jennybc
Copy link

jennybc commented Nov 18, 2014

I don't get the same results as you in the last two cases, which makes me think you should update dplyr. In my hands, even the last two statements return something of class tbl_df and data.frame.

@hadley
Copy link

hadley commented Nov 18, 2014

Yeah, check your dplyr version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment