Going deeper with dplyr: New features in 0.3 and 0.4 (tutorial)

Data School · 40K views · 2015 · 36:54

Open on YouTube

Data science & statisticsPython, Ruby & scripting languagestutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it to explain dplyr behaviors such as local data frames and the need for ungroup, often with the author himself pointing to it.

Recommended by 2 people across 2 different months, 2015 to 2016.

What it is

A 37-minute R tutorial by Kevin Markham of Data School covering new features in dplyr 0.3 and 0.4. It works through examples on the nycflights13 dataset, covering select, filter, mutate, grouping, joins, and local data frames.

What people said

Recommends grove80904 · 2015-11 · Stack Overflow · on “Arrange grouped local data frame in descending order”

Figured it out while watching this dplyr tutorial (around minute 22 of the video) [this video] . When grouping by 2 or more variables, only the last variable is removed after a `mutate`/`summarize` command. Therefore the `ungroup` command is needed. If I had only grouped by 1 variable, the `ungroup` command wouldn't be necessary.

Recommends Kevin Markham · 2016-02 · Stack Overflow · on “What is the meaning of the "local data frame" message from `dplyr:::print.tbl_df`?”

I'm the author of the video tutorial [this video] mentioned in the question. Here's a summary of the functions relevant to this discussion: data.frame() is R's function for creating regular data frames. data_frame() is dplyr's function for creating local data frames. tbl_df() and as_data_frame() are dplyr's functions for converting a regular data frame (or a list) into a local data frame. So, what is the difference between regular and local data frames? Very little. A local data frame is just a regular data frame that has been wrapped with the tbl_df class for nicer printing. (The data is still stored in a regular data frame "under the hood".) Specifically, printing a local data frame only shows

Cites Tyler Rinker · 2015-03 · Stack Overflow · on “What is the meaning of the "local data frame" message from `dplyr:::print.tbl_df`?”

When using dplyr , the tbl_df function prints a statement saying the data frame is "local": > mtcars %>% + group_by(gear) Source: local data frame [32 x 11] Groups: gear mpg cyl ... 1 21.0 6 ... I thought a local data frame meant in-memory, and a non-local data frame was a database like SQL. I think I'm wrong in that assumption, though. In this tutorial video [this video] at approximately 25:25, Kevin Markham says that data.frame objects are not local data frames, which I believed they were. I looked through the tbl_df documentation and used a search function in the dplyr introduction vignette [LINK] , but can't find a description of a local data frame. Question: What is a local data frame?