diff --git a/session_1/slides_b.Rmd b/session_1/slides_b.Rmd index f239afe72c60adc2f6a7e1c78d6f3f8d9b24209f..1831f7543252f7d4596f0d11d5892a3345b3900f 100644 --- a/session_1/slides_b.Rmd +++ b/session_1/slides_b.Rmd @@ -114,7 +114,7 @@ base_test <- function(x, base){ RStudio offers you great flexibility in running code from within the editor window. There are buttons, menu choices, and keyboard shortcuts. To run the current line, you can -- click on the Run button above the editor panel, or +- Click on the Run button above the editor panel, or - select “Run Lines†from the “Code†menu, or - hit Ctrl+Return in Windows or Linux or Cmd+Return on OS X. To run a block of code, select it and then Run. @@ -281,7 +281,7 @@ all.equal(x, y) ## Vector challenge - use the `seq()` function to create a vector of even numbers -- You can concatenate vector with `c(<VECTOR_1>, <VECTOR_2>)`, concatenate a vector of integer with a vector of the first 5 letter of the alphabet. +- You can concatenate vector with `c(<VECTOR_1>, <VECTOR_2>)`, concatenate a vector of integers with a vector of the first 5 letters of the alphabet. - Check the default vectors `letters` and `LETTERS`, rewrite your previous command using them. - Create a vector giving you the correspondence between small case letters and upper case letters. @@ -291,7 +291,7 @@ all.equal(x, y) ```R seq(from=2, to=10, by=2) ``` -- You can concatenate vector with `c(<VECTOR_1>, <VECTOR_2>)`, concatenate a vector of integer with a vector of the first 5 letter of the alphabet. What is the type of this vector. +- You can concatenate vector with `c(<VECTOR_1>, <VECTOR_2>)`, concatenate a vector of integers with a vector of the first 5 letters of the alphabet. What is the type of this vector. - Check the default vectors `letters` and `LETTERS`, rewrite your previous command using them. - Create a vector giving you the correspondence between small case letters and upper case letters. @@ -301,14 +301,14 @@ seq(from=2, to=10, by=2) ```R seq(from=2, to=10, by=2) ``` -- You can concatenate vector with `c(<VECTOR_1>, <VECTOR_2>)`, concatenate a vector of integer with a vector of the first 5 letter of the alphabet. What is the type of this vector. +- You can concatenate vector with `c(<VECTOR_1>, <VECTOR_2>)`, concatenate a vector of integers with a vector of the first 5 letters of the alphabet. What is the type of this vector. - Check the default vectors `letters` and `LETTERS`, rewrite your previous command using them. - Create a vector giving you the correspondence between small case letters and upper case letters. ### Vector challenge - use the `seq()` function to create a vector of even numbers -- You can concatenate vector with `c(<VECTOR_1>, <VECTOR_2>)`, concatenate a vector of integer with a vector of the first 5 letter of the alphabet. What is the type of this vector. +- You can concatenate vector with `c(<VECTOR_1>, <VECTOR_2>)`, concatenate a vector of integers with a vector of the first 5 letters of the alphabet. What is the type of this vector. ```R c(1:5, "a", "b", "c") typeof(c(1:5, "a", "b", "c")) @@ -319,7 +319,7 @@ typeof(c(1:5, "a", "b", "c")) ### Vector challenge - use the `seq()` function to create a vector of even numbers -- You can concatenate vector with `c(<VECTOR_1>, <VECTOR_2>)`, concatenate a vector of integer with a vector of the first 5 letter of the alphabet. What is the type of this vector. +- You can concatenate vector with `c(<VECTOR_1>, <VECTOR_2>)`, concatenate a vector of integers with a vector of the first 5 letters of the alphabet. What is the type of this vector. - Check the default vectors `letters` and `LETTERS`, rewrite your previous command using them. ```R c(1:5, letters[1:3]) @@ -329,7 +329,7 @@ c(1:5, letters[1:3]) ### Vector challenge - use the `seq()` function to create a vector of even numbers -- You can concatenate vector with `c(<VECTOR_1>, <VECTOR_2>)`, concatenate a vector of integer with a vector of the first 5 letter of the alphabet. What is the type of this vector. +- You can concatenate vector with `c(<VECTOR_1>, <VECTOR_2>)`, concatenate a vector of integers with a vector of the first 5 letters of the alphabet. What is the type of this vector. - Check the default vectors `letters` and `LETTERS`, rewrite your previous command using them. - Create a vector giving you the correspondence between small case letters and upper case letters. ```R diff --git a/session_2/slides.Rmd b/session_2/slides.Rmd index 2cd63a353438ba6f8c2c03179ea49483d52a7453..a39dbadfaf44240af321a9a2a58df550df10836c 100644 --- a/session_2/slides.Rmd +++ b/session_2/slides.Rmd @@ -185,8 +185,8 @@ ggplot(data = <DATA>) + - Run `ggplot(data = new_mpg)`. What do you see? - How many rows are in `new_mpg`? How many columns? - What does the `cty` variable describe? Read the help for `?mpg` to find out. -- Make a scatterplot of `hwy` vs `cyl`. -- What happens if you make a scatterplot of `class` vs `drive`? Why is the plot not useful? +- Make a scatterplot of `hwy` vs. `cyl`. +- What happens if you make a scatterplot of `class` vs. `drive`? Why is the plot not useful? ### Run `ggplot(data = mpg)`. What do you see? @@ -200,14 +200,14 @@ ggplot(data = new_mpg) new_mpg ``` -### Make a scatterplot of `hwy` vs `cyl`. +### Make a scatterplot of `hwy` vs. `cyl`. ```{r new_mpg_plot_b, cache = TRUE, fig.width=8, fig.height=4.5} ggplot(data = new_mpg) + geom_point(mapping = aes(x = hwy, y = cyl)) ``` -### What happens if you make a scatterplot of `class` vs `drive`? +### What happens if you make a scatterplot of `class` vs. `drive`? Why is the plot not useful? ```{r new_mpg_plot_c, cache = TRUE, fig.width=8, fig.height=4.5} @@ -226,7 +226,7 @@ ggplot(data = mpg) + mapping = aes(x = displ, y = hwy), color = "red") ``` -### Aesthetic mappings `color` +### Aesthetic mapping `color` ```{r new_mpg_plot_e, cache = TRUE, fig.width=8, fig.height=4.5} ggplot(data = mpg) + @@ -244,21 +244,21 @@ Try the following aesthetic: - `alpha` - `shape` -### Aesthetic mappings `size` +### Aesthetic mapping `size` ```{r new_mpg_plot_f, cache = TRUE, fig.width=8, fig.height=4.5, warning=FALSE} ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy, size = class)) ``` -### Aesthetic mappings `alpha` +### Aesthetic mapping `alpha` ```{r new_mpg_plot_g, cache = TRUE, fig.width=8, fig.height=4.5, warning=FALSE} ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy, alpha = class)) ``` -### Aesthetic mappings `shape` +### Aesthetic mapping `shape` ```{r new_mpg_plot_h, cache = TRUE, fig.width=8, fig.height=4.5, warning=FALSE} ggplot(data = mpg) + @@ -385,7 +385,7 @@ ggplot(data = mpg, mapping = aes(x = displ, y = hwy, color = drv)) + - What does `show.legend = FALSE` do? - What does the `se` argument to `geom_smooth()` do? -## Fird challenge +## Third challenge - Recreate the R code necessary to generate the following graph @@ -395,7 +395,7 @@ ggplot(data = mpg, mapping = aes(x = displ, y = hwy, color = drv)) + geom_smooth(mapping = aes(linetype = drv)) ``` -## Fird challenge +## Third challenge ```{r new_mpg_plot_v, cache = TRUE, fig.width=8, fig.height=4.5, message=FALSE} ggplot(data = mpg, mapping = aes(x = displ, y = hwy, color = drv)) +