Interactive worksheets

This section contains interactive worksheets that we will work through during class to get a bit of practice working with R before turning to using R on your own computer within RStudio. These worksheets provide a sort of coding playground that you can always come back to if you want some practice. Note that more complex worksheets may take a moment for the everything to load.

An interactive code section looks like this. Make changes in the text box and use the blue Run button to run the code. Change the code and run it as many times as you want. The original text can be reset with the Start Over button.

The interactive code may not always be complete in which case you will be prompted to complete the code to get it to run correctly. These interactive code blocks may have hints and even solutions.

For example, fill in the blank so that the result of the sum is 10.

NoteHint

Make sure to delete the underscores before entering the correct number.

1 + 2 + 3 + 
TipSolution
1 + 2 + 3 + 4

We will be able to practice quite complex skills with these interactive lessons, including data visualizations. Let’s see how this works using the penguins dataset that comes with newer versions of R. The dataset contains body measurements of three species of penguins collected by the Palmer Station in Antarctica. For more about the data, see the palmerpenguins package.

A cartoon-style drawing of chinstrap, gentoo and adélie penguins.

Artwork by @allison_horst

For instance, we can visualize a comparison of the flipper length to the body weight of the three species of penguins. Try it out by running the code! Test out what happens if you change things.

The ability to run R code in your browser is relatively new and is made possible by the quarto-live extension.