WeData’s ultimate exercises

Goal of this website ?

The aim of this website is to be a compendium of knowledge on R made by members of the WeData association. It should serve both as a reference for knowledge, and as an exercise interface. We hope to highlight some important themes in this book.

Why R?

  • It is free
  • Data analysis and statics ecosystem
  • Beautiful visualization capabilities
  • Amazing reporting tools
  • Web application development
  • Vibrant and nice community
  • Widely used in research
  • Key tools in specific sectors

Why this website?

Why this website? To complete existing resources with exercises. In fact, there are already numerous free or paid resources on R scattered on the internet. The main concern is not about knowing if a resource exists but about finding it. Rarely do collaborative projects try to bring together various R resources in the form of a book or website. Here are some notable examples I know of (there are probably more):

It is amusing to find excellent resources hidden in Rmarkdown and Quarto galleries. We believe that despite the dissemination of resources, the community is doing a fantastic job trying to consolidate them, and I strongly encourage anyone interested in contributing to this effort to feed the sources mentioned earlier. However, another problem remains: there is a glaring lack of exercises and interactive resources. It’s important to note that there are platforms for doing R exercises online to some degree of interactivity. Notable cases include Exercism, Codewars and W3school (for a more comprehensive list, check our blog post). There is also the learnr package, which allows creating interactive R exercises using Rmarkdown. The system is great (at least locally), but when it comes to putting exercises online for use without installing R, it requires an active server, adding more work and concerns, particularly regarding hosting and managing a large number of requests. Our goal would be to create an exercise platform that does not require running R on a server. Is this possible? The answer is yes!

The advancements in web technologies over the past few years have given us hope to create online interactive exercise platforms without a server, and it was only recently that the idea of reusing a system like learnr within webr (the Quarto extension) surfaced. These developments are very encouraging and have inspired the creation of this platform.

Our association is made up of passionate individuals with varying levels, goals, and interests. But I believe we can create an interactive resource that allows curious people to train. The objective will be to create exercise series and recommend existing resources to help users complete the exercises.

This is new territory for me, and I don’t know if it will work. Perhaps I’m missing essential elements, or web pages might be unbelievably slow or inefficient. But I believe it’s worth a try!

Exercice example from quarto-live

As we said earlier, thanks to webr, it’s now possible to use R in the browser without the need for a server (a computer that’s always running). To be more precise, R is translated into WebAssembly, which runs in the browser. All thanks to webr. If you don’t believe me, you can try R in the browser here. Or you can test it just below using the code or writting yours:

Magic! You can use it without an R, even on your cell phone!

Quarto’s strength lies in its ability to integrate it so seamlessly into its ecosystem. This has enabled the same webr authors to create the quarto-live extension, which adds the elements needed to create online exercises. So we can easily create interactive online exercises simply by hosting our website on a GitHub repository, with no real performance problems.

We can thank quarto-live for this feat. Here is an example of an exercise suggested in the documentation:

Filter the starwars dataset so that only the droid characters are included.

Hint 1

Consider using the filter() function from dplyr.

starwars |> filter(______)
Hint 2

You should filter the dataset using the species column.

starwars |> filter(species == ______)
Fully worked solution:

Use the filter() function from dplyr:

1starwars |>
2    filter(species == "Droid")
1
Take the starwars dataset, and then,
2
Filter for the “Droid” species.

Fantastic! This allows you to have the capabilities of {learnr} without the need to install R or have a server to hold it all together. Note that quarto-live is still in its infancy and will probably improve over time.

What you will learn in this book

You will learn the basics of programming and statistics with R. In addition to these topics we will cover:

  • Data manipulation with R
  • Data analysis with R
  • Data visualization with R
  • Network analysis
  • Spatial analysis
  • Web scraping and much more!

Now that you know why this platform was created and what you can learn, you’re free to do the exercises available on the website, or you can read the contribution page if you’d like to help.