Skip to content
Snippets Groups Projects
Unverified Commit ff326ec9 authored by Laurent Modolo's avatar Laurent Modolo
Browse files

session 1 & 2 fix typos

parent 4067f3ab
Branches
No related tags found
No related merge requests found
...@@ -114,7 +114,7 @@ base_test <- function(x, base){ ...@@ -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 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 - 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. - 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) ...@@ -281,7 +281,7 @@ all.equal(x, y)
## Vector challenge ## Vector challenge
- use the `seq()` function to create a vector of even numbers - 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. - 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. - Create a vector giving you the correspondence between small case letters and upper case letters.
...@@ -291,7 +291,7 @@ all.equal(x, y) ...@@ -291,7 +291,7 @@ all.equal(x, y)
```R ```R
seq(from=2, to=10, by=2) 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. - 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. - 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) ...@@ -301,14 +301,14 @@ seq(from=2, to=10, by=2)
```R ```R
seq(from=2, to=10, by=2) 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. - 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. - Create a vector giving you the correspondence between small case letters and upper case letters.
### Vector challenge ### Vector challenge
- use the `seq()` function to create a vector of even numbers - 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 ```R
c(1:5, "a", "b", "c") c(1:5, "a", "b", "c")
typeof(c(1:5, "a", "b", "c")) typeof(c(1:5, "a", "b", "c"))
...@@ -319,7 +319,7 @@ typeof(c(1:5, "a", "b", "c")) ...@@ -319,7 +319,7 @@ typeof(c(1:5, "a", "b", "c"))
### Vector challenge ### Vector challenge
- use the `seq()` function to create a vector of even numbers - 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. - Check the default vectors `letters` and `LETTERS`, rewrite your previous command using them.
```R ```R
c(1:5, letters[1:3]) c(1:5, letters[1:3])
...@@ -329,7 +329,7 @@ c(1:5, letters[1:3]) ...@@ -329,7 +329,7 @@ c(1:5, letters[1:3])
### Vector challenge ### Vector challenge
- use the `seq()` function to create a vector of even numbers - 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. - 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. - Create a vector giving you the correspondence between small case letters and upper case letters.
```R ```R
......
...@@ -185,8 +185,8 @@ ggplot(data = <DATA>) + ...@@ -185,8 +185,8 @@ ggplot(data = <DATA>) +
- Run `ggplot(data = new_mpg)`. What do you see? - Run `ggplot(data = new_mpg)`. What do you see?
- How many rows are in `new_mpg`? How many columns? - How many rows are in `new_mpg`? How many columns?
- What does the `cty` variable describe? Read the help for `?mpg` to find out. - What does the `cty` variable describe? Read the help for `?mpg` to find out.
- Make a scatterplot of `hwy` vs `cyl`. - Make a scatterplot of `hwy` vs. `cyl`.
- What happens if you make a scatterplot of `class` vs `drive`? Why is the plot not useful? - 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? ### Run `ggplot(data = mpg)`. What do you see?
...@@ -200,14 +200,14 @@ ggplot(data = new_mpg) ...@@ -200,14 +200,14 @@ ggplot(data = new_mpg)
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} ```{r new_mpg_plot_b, cache = TRUE, fig.width=8, fig.height=4.5}
ggplot(data = new_mpg) + ggplot(data = new_mpg) +
geom_point(mapping = aes(x = hwy, y = cyl)) 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? Why is the plot not useful?
```{r new_mpg_plot_c, cache = TRUE, fig.width=8, fig.height=4.5} ```{r new_mpg_plot_c, cache = TRUE, fig.width=8, fig.height=4.5}
...@@ -226,7 +226,7 @@ ggplot(data = mpg) + ...@@ -226,7 +226,7 @@ ggplot(data = mpg) +
mapping = aes(x = displ, y = hwy), color = "red") 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} ```{r new_mpg_plot_e, cache = TRUE, fig.width=8, fig.height=4.5}
ggplot(data = mpg) + ggplot(data = mpg) +
...@@ -244,21 +244,21 @@ Try the following aesthetic: ...@@ -244,21 +244,21 @@ Try the following aesthetic:
- `alpha` - `alpha`
- `shape` - `shape`
### Aesthetic mappings `size` ### Aesthetic mapping `size`
```{r new_mpg_plot_f, cache = TRUE, fig.width=8, fig.height=4.5, warning=FALSE} ```{r new_mpg_plot_f, cache = TRUE, fig.width=8, fig.height=4.5, warning=FALSE}
ggplot(data = mpg) + ggplot(data = mpg) +
geom_point(mapping = aes(x = displ, y = hwy, size = class)) 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} ```{r new_mpg_plot_g, cache = TRUE, fig.width=8, fig.height=4.5, warning=FALSE}
ggplot(data = mpg) + ggplot(data = mpg) +
geom_point(mapping = aes(x = displ, y = hwy, alpha = class)) 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} ```{r new_mpg_plot_h, cache = TRUE, fig.width=8, fig.height=4.5, warning=FALSE}
ggplot(data = mpg) + ggplot(data = mpg) +
...@@ -385,7 +385,7 @@ ggplot(data = mpg, mapping = aes(x = displ, y = hwy, color = drv)) + ...@@ -385,7 +385,7 @@ ggplot(data = mpg, mapping = aes(x = displ, y = hwy, color = drv)) +
- What does `show.legend = FALSE` do? - What does `show.legend = FALSE` do?
- What does the `se` argument to `geom_smooth()` do? - What does the `se` argument to `geom_smooth()` do?
## Fird challenge ## Third challenge
- Recreate the R code necessary to generate the following graph - 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)) + ...@@ -395,7 +395,7 @@ ggplot(data = mpg, mapping = aes(x = displ, y = hwy, color = drv)) +
geom_smooth(mapping = aes(linetype = 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} ```{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)) + ggplot(data = mpg, mapping = aes(x = displ, y = hwy, color = drv)) +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment