A beginner’s guide.
This course will show you different ways of manipulating data thanks to the following Dynamic Animations. (Aden-Buie 2020)
Tidy data follows the following three rules:
Many of the tools in the tidyverse expect data to be formatted as a tidy dataset and the tidyr package provides functions to help you organize your data into tidy data.
To go from wide to long or to long to wide, you’ll need the spread() and gather() functions.
The spread function allows you to transform your data from a long format to a wide format.
The gather function allows you to transform your data from a wide format to a long format.
To join two tables together : left_join(), right_join(), inner_join(), semi_join etc.
All rows from x, and all columns from x and y. Rows in x with no match in y will have NA values in the new columns.
All rows from y, and all columns from x and y. Rows in y with no match in x will have NA values in the new columns.
All rows from x where there are matching values in y, and all columns from x and y.
All rows and all columns from both x and y. Where there are not matching values, returns NA for the one missing.
All rows from x where there are matching values in y, keeping just columns from x.
All rows from x where there are not matching values in y, keeping just columns from x.
Common rows in both x and y, keeping just unique rows.
All unique rows from x and y.
Aden-Buie, Garrick. 2020. “Gadenbuie/Tidyexplain.” https://github.com/gadenbuie/tidyexplain.
For attribution, please cite this work as
Warin (2020, March 10). Thierry Warin, PhD: [R Course] Data Wrangling with R: Tidyverse. Retrieved from https://warin.ca/posts/rcourse-datawranglingwithr-tidyverse/
BibTeX citation
@misc{warin2020[r, author = {Warin, Thierry}, title = {Thierry Warin, PhD: [R Course] Data Wrangling with R: Tidyverse}, url = {https://warin.ca/posts/rcourse-datawranglingwithr-tidyverse/}, year = {2020} }