今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Making wide datasets long with pivot_longer()
- [Lecturer] Analysts working in R often find themselves in a situation where they want to convert a wide data set into a longer version. The pivot_longer function makes this easy. Now, in the last video I gave you the example of this Pew Religion data set that is wide, and describes how a data scientist might prefer to convert it to a longer format. Let's take a look at how we can perform this conversion in R. The tidyr library within the tidyverse contains a function called pivot_longer, that takes a wide data set and makes it longer by gathering the information from columns and putting it into rows. The pivot_longer function works using the concept of values and names. Now, values means the same thing that it does in the world of tidy data. It's the actual data point in a table that represents the observation of a single variable. The names are how we identify the variable described by the value, they're the…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。