library(learnr) library(testwhat) knitr::opts_chunk$set(echo = FALSE) tutorial_options(exercise.timelimit = 60, exercise.checker=testwhat::testwhat_learnr) require(tidyverse) penguins<- readr::read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-07-28/penguins.csv")
penguins<- readr::read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-07-28/penguins.csv")
We are going to use the penguins data to produce a variety of scatter plots using the base R function plot()
.
head(penguins)
Produce a plot of bill length against bill depth:
ggplot(penguins) + geom_point(aes(bill_depth_mm, bill_length_mm))
ex() %>% { check_error(.) check_function(., "geom_point") %>% check_arg(., "mapping") %>% check_equal(.) }
Produce a plot that will compare the bill length against the bill depth, with different colours indicating the three different species "Adelie","Gentoo","Chinstrap". Adelie should be coloured purple, Gentoo should be orange and Chinstrap should be red.
ggplot(penguins) + geom_point(aes(bill_depth_mm, bill_length_mm, colour=species))
ex() %>% { check_error(.) check_function(., "geom_point") %>% check_arg(., "mapping") %>% check_equal(.) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.