LoslegenKostenlos loslegen

Ordering one variable by another

Often we'll need to modify our dataset before we can plot it. If we do this with dplyr functions and the %>%, you can continue by %>% your dataset into ggplot(). It works just like all the functions you use the %>% for because data is the first argument ggplot() takes, and then you can write the rest of the arguments (like aes()) inside the ggplot() call. Just don't forget you have to switch back to + when you add on the rest of the ggplot() code!

Let's try it out by first modifying multiple_choice_responses and then plotting the results in a scatterplot. We'll also need a forcats function to put our graph in a better order.

Diese Übung ist Teil des Kurses

Categorical Data in the Tidyverse

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

multiple_choice_responses %>%
  # Remove NAs
  ___ 
Code bearbeiten und ausführen