diff --git a/episodes/02-data-structures.Rmd b/episodes/02-data-structures.Rmd index 5ae52482..b47df1c2 100644 --- a/episodes/02-data-structures.Rmd +++ b/episodes/02-data-structures.Rmd @@ -97,7 +97,7 @@ abcd_vector ::::::::::::::::::::::::::::::::::::: challenge -### Exercise +### Challenge: combining vectors Combine the `abcd_vector` with the `numeric_vector` in R. What is the data type of this new vector and why? diff --git a/episodes/03-explore-data.Rmd b/episodes/03-explore-data.Rmd index aef056e6..bc5c64e9 100644 --- a/episodes/03-explore-data.Rmd +++ b/episodes/03-explore-data.Rmd @@ -91,7 +91,7 @@ In each line after a `$` sign, we see the name of each column, its type and firs There are multiple ways to explore a data set. Here are just a few examples: -```{r} +```{r examine-data} head(gapminder) # shows first 6 rows of the data set @@ -159,7 +159,7 @@ First we define data set, then - with the use of pipe we pass it on to the `sele We already know how to select only the needed columns. But now, we also want to filter the rows of our data set via certain conditions with `filter()` function. Instead of doing it in separate steps, we can do it all together. In the `gapminder` data set, we want to see the results from outside of Europe for the 21st century. -```{r} +```{r filter-data} year_country_gdp_euro <- gapminder %>% filter(continent != "Europe" & year >= 2000) %>% select(year, country, gdpPercap) @@ -170,7 +170,7 @@ head(year_country_gdp_euro) ::: challenge -## Exercise 1 +## Challenge: filtered data frame Write a single command (which can span multiple lines and includes pipes) that will produce a data frame that has the values for life expectancy, country and year, only for Eurasia. How many rows does your data frame have and why? @@ -201,7 +201,7 @@ gapminder %>% # select the dataset ::: challenge -## Exercise 2 +## Challenge: longest and shortest life expectancy Calculate the average life expectancy per country. Which country has the longest average life expectancy and which has the shortest average life expectancy?