Tidyverse code challenges?

Does anyone know of any code challenges, similar to: https://www.hackerrank.com/domains/python/py-introduction , but for the tidyverse specifically? I think it would really help to get others familiar with how to leverage some of these tools to solve problems, but I'm curious if anyone has already tried to create something like this?(especially for getting used to rlang and purrr?)

1 Like

By "similar to" are you referring to the interactive format?

Hadley's book always have tests for understanding at the beginning and end of each chapter. They are not always code but they do a good job of challenging you.

Yeah, other than DataCamp and their app, I can't really say I've ran into a resource that's interactive like Hacker Rank.

Yeah, so there's actually an R package from RStudio, learnr, that does just that: progressive reveal, code checking, etc. (See the Exercises section for more detail).

In my limited experience of coding interactive tutorials, it can be surprisingly tricky to set these types of things up across various platforms (I have no clue what the Hacker Rank setup is). But, given learnr is designed for R, that should make for an easy/easier, good match.

As per usual, time is the limiting factor, but based on the activity in threads such as the one below, it's the type of thing that could do well under open development.

cc @jessemaegan curious if you think this would have made a difference in early stages of the open R4DS course! :woman_teacher:


I want to be able to test my knowledge of R from a simple platform, without having to install a package to do so. For me, to tell someone to install a package is too high of a bridge to cross when testing my knowledge. It's particularly nice to have a platform which is designed to be lightweight(even sites like this:https://regexone.com/)

I would be extremely interested if RStudio plans to make lessons on Hacker Rank, as I think it would really help solidify data wrangling tasks, and preferred ways of interacting with data.

Perhaps you didn't see the examples, it's not a package one would install in order to learn R. It's a package which allows one to make exercises such as you were describing using R, and Shiny.


But that's precisely my question: the learnr package is designed for building interactive tutorials; I'm not interested in building a tutorial, I want to test out my knowledge of R, and the tidyverse.

Does RStudio have any plans to create something like this?

If you want to test your R & tidyverse, and help people while you're at it, might I suggest StackOverflow?

Never a dull moment when answering questions, plenty of variety in questions, and looking at others answers always helps me learn!

1 Like


I have a million thoughts about the next iteration and won't hijack this thread, but yes, integrating something like this would be incredibly helpful. the biggest issue we're encountering seems to be navigating the gap from beginner to where the text picks up, especially in the later programming sections.

1 Like


Has a ton of coding challenges that only checks your output that you can paste in. The site has a few compilers and interpreters built into the site (Not R) but you can follow the challenges and do it using tidyverse methods.

There's also going to be a couple of follow-ups to @drob's new "Introduction to the Tidyverse". More advanced topics with the DataCamp interface could be just what you're looking for.

1 Like

Not to steal @jessemaegan thunder, but I would echo that tools like that are extremely necessary to teach newcomers to R. I think the end goal is to create a platform that provides "a path of least resistance" to the user, with the aim to get them immersed as fast as possible. As a newcomer, I should not have to even install the language on my system to learn it; it should be platform-agnostic. The goal should be not to force someone to install a package, but rather get them immersed within the language as fast as possible, which is exactly what these sites are so good at.

That's precisely why I love these lightweight platforms, which try to make it as simple as possible for someone to come in and really learn the language.

Related to this, it's pretty hard to find a generic platform to share runnable, agnostic R code on. I remember having to search far and wide to run a place where I could share runnable R code in my browser (not just a pastebin link to a script or some gist). R Fiddle was OK, but just felt clunky. I'm assuming that's why R-Cloud was created in the first place, to fill that void?

1 Like

There is an open source tool to learn R that is swirl. This is a package that you can install locally and come with several courses to learn R in your R session. Some people of the community created great courses that you could find available on the web, mainly github.

The swirl course network presents a list of available course. I am sure there are others available not in this list like the one on Regex by Jon Calder.

All these course can be seen as challenges to test your skill.

Otherwise, I did not know of a website with challenge for R. Already mentionned Datacamp is a great alternative. I think you can also do some swirl courses on their platform.


Regarding the several asks in this thread:

Depending on your skill level, I'd recommend:

None will require you to install a package; but I suggest that you learn how to install a package as soon as you can. It is not that difficult, and it has enormous payoffs.

Yes. RStudio Cloud will feature a set of interactive tutorials that will cover the basics of what you find in R4DS. We're calling them "Primers", and I think you can see them in RStudio Cloud even now.

I wrote a book that bridges that gap before I worked on R4DS with Hadley. The book is called Hands-On Programming with R. Unfortunately, I didn't have the leverage back then to negotiate a free online copy, which I regret.

In addition to Datacamp and Try R, swirl also provides an excellent way to cover this ground (as @cderv mentioned). To be clear, I think the skills that we are talking about here are what one could call "the basics of R." I'll be adding them to the RStudio Cloud Primers.

This will be a perfect use case for RStudio Cloud!


yes, this is a fantastic book and I've used it quite a bit! there's still a bit of a language barrier for absolute beginners, but overall it's incredibly accessible.

One good way to learn code is also via flash cards. The concept of spaced repetition, which basically weights easy questions lower is already implemented in the free and cross platform (even working on mobile) tool Anki.

There is also an r package called r2anki, which allows to import the r code highlighting into the flash cards. The pkg is still in dev, but already works. Here the talk from @henningsway at use!R.

The challenge would be to create tidyverse learn cards. I'ld guess starting with translating tasks from a cookbook or examples from cheatsheets would be a good start to create tidyverse flashcards decks.

The cool thing is that these decks can be synched and shared via anki online, so that the whole community would profit from anyone who creates a deck. Also for package authors this would be a nice thing to promote their pkg. And it could also be used to switch from dplyr to data.table, etc.

Of course there are many other approaches as mentione above, but the anki approach would be really easy, it could scale and even beginners could design flash cards.


For basic stuff in other languages I used the apps from https://www.sololearn.com/. They also have a ranking system and I would love to see an app by them for learning R.

1 Like

I agree with that, I've done it myself when I felt confident enough to test my skills to real problems. The downsides are that some people answer really fast to simple questions, and it can be tough to be the first to reply/having an accepted answer. Another downside is that sometimes people ask a question, you begin to get an answer, but it's closed as duplicate and you cannot post your answer. Or they delete their questions.
But either way, I think you have progressed and built some skills even when not answering, and you can appreciate the answers others give more as you've thought about it too.

1 Like