Closed mikemahoney218 closed 3 years ago
Good catch! With the transition to using tibbles, I think this section could be greatly simplified. I don't think it's necessary to get into the details of the differences between tibbles and data.frames given the intended audience for these lessons.
Would you be willing to start a pull request that addresses this issue?
Thank you!
Of course! Opened #683 .
closed by #683
There appears to be an error in the indexing and subsetting data frames section of Starting with Data. While subsetting base data frames with
df[, col]
returns a vector, subsetting tibbles with this format return a dataframe identically to subsetting viadf[col]
:Created on 2021-01-26 by the reprex package (v0.3.0)
I imagine this has changed since the lesson was first written as tibble strives to improve consistency. As we read in the
surveys
data set withreadr::read_csv
, the table is read in as a tibble, and the comment in the text (that subsetting with the comma returns a vector) is incorrect.With that said, I don't know if it makes sense to specifically highlight that this is one of the differences with tibbles that the lesson earlier says isn't worth getting into, or to not mention that base data frames behave differently. It might make sense to mention when introducing tibbles that the goal of tibbles are to provide more consistent behavior than base data frames, which would provide a basis for flagging those differences as they come up?