some thoughts about dplyr and purrr documentation

I'm wondering if there is any articles about functions besides the basic dplyr verbs (mutate, filter and select etc.), such as at, if and all variants. It's very helpful to know the ideas behind the function and how some functions works together.

I find it is hard to read dplyr's source code. And it's a bit of hard for me to read the help documentation of the functions like at, if and all variants at the first time. Only after reading the same help file several times, I come to understand them a bit.

I notice some functions such as ?purrr::map_dfc don't have their own example and I can't imagine a use case.

I wish there are some resources for people who is not so clever or experienced.

Dplyr and purrr are not unique in R in being opaque to beginners.

There is one big, one medium and one small thing to help.

  1. Realize that R is school algebra writ large. Every page of documentation begins with the functions signature, and expanded version of f(x) = y, explaining x (and usually many other arguments), listing what they are and describing the type of object, y that they return. The examples are just there to give a practical demonstration of the type of input and output. It's always a good idea to work them and try varying the inputs to make sure you understand how the output changes or whether they are even legal.

  2. There are often useful links in the help page.

help(dplyr)

will point you to https://dplyr.tidyverse.org which will point you for more detail to https://dplyr.tidyverse.org

It is always worth while to scroll to the bottom of the help page to look for any User Guide, Package Vignettes and other documentation.

  1. Cheatsheets, especially in the tidyverse give condensed guidance that allow you to more readily see how functions interact. See https://www.rstudio.com/resources/cheatsheets/

Also, as we point out in the READMEs and the pkgdown documentation, much of the documentation is expanded upon in the relevant chapters in R for Data Science (freely available online)!
e.g. for purrr

The scoped variants are relatively new, and we are currently in the process of upping their documentation.

Suzan Baert has some great material on lesser-known dplyr functions (I collected some in a Twitter moment when she was curating the rotating R Ladies account):
https://twitter.com/i/moments/1044926554239881217

And she has more in this repo:

And in a series on her blog:

For purrr, I rounded up some of my favourite resources here, which includes a great series of posts by Colin Fay.

5 Likes

@mara Many thanks. Just go through the two blogs. It's extremely useful.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.