I'm having major issues creating a learnr tutorial, but this only seems to be an issue in the very middle of my tutorial...
I'm using the palmerpenguins dataset for the tutorial and things are all fine and dandy.
My setup chunk looks like:
library(learnr) library(tidyverse) library(palmerpenguins) knitr::opts_chunk$set(echo = TRUE)
This code chunk works perfectly:
## loading ALL tidyverse packages at once because we'll be using many of them, normaly required #library(tidyverse) ## filtering for Chinstrap AND Gentoo penguins from the species column of penguins penguin_chin_gent <-filter(penguins, species == "Chinstrap" & species == "Gentoo") head(penguin_chin_gent) ## filtering for Chinstrap OR Gentoo penguins from the species column of penguins penguin_chin_gent <- filter(penguins, species == "Chinstrap" | species == "Gentoo") # print the first couple rows head(penguin_chin_gent)
And then when I get to this code chunk:
## what are the column names of our dataset again? Let's check colnames(penguin_chin_gent) head(penguin_chin_gent) ## OK, so body weight is found under column "body_mass_g". Let's select body_mass_g and species so that we ## can calculate the mean body weight of each species. head(penguin_chin_gent_bw) tail(penguin_chin_gent_bw) ## what does this function do? count(penguin_chin_gent_bw, species)
The users encounter the error:
object 'penguin_chin_gent' not found.
This might be a beginner R markdown issue but I can't seem to figure out the problem here. Other data persists between code chunks, just not this one object.
Any help GREATLY appreciated!!