R - mutate_at() versus mutate(across(a:d, mean))

Hi!

I’m working on this page: https://app.dataquest.io/m/323/data-cleaning-with-r/4/ap-exam-data-changing-data-types-and-creating-a-new-variable

and the recommendation is to use mutate_at(). However, this has been deprecated for the use of across() for use across columns within functions such as mutate() and summarise(). See below.

1 Like

Dataquest uses a slightly older version (0.8.5) of dplyr on their platform, while the latest one, as per your link seems to be 1.0.2. But they were both released this year.

So, you are bound to get differences in use-case of certain functions/methods because of that. So, best to stick with the Dataquest version use-cases unless you are working locally with the latest version.

I do seem to have some trouble finding the right documentation for the version used on their platform. I am not well-versed with R, yet, to be able to direct you better in regards to that. Maybe @casey can shed some light on the documentation for that version.

2 Likes

Hi @tlkantro and @the_doctor. Thanks for posting.

We are currently working on an optimization of this Data Cleaning with R course, and plan to update dplyr to the latest version. The release of dplyr 1.0.0 was a major release that includes some significant improvements. dplyr is used in many courses and missions across the Dataquest R path, so we are currently scoping the effort to update dplyr.

And fortunately, it’s still possible to find documentation for superseded functions like mutate_at() on the tidyverse website, as included in the post above.

Best,
-Casey

1 Like