Skip to content

Commit

Permalink
typos and general updates
Browse files Browse the repository at this point in the history
  • Loading branch information
b-rodrigues committed Nov 7, 2020
1 parent 54661f3 commit 0ba7370
Show file tree
Hide file tree
Showing 93 changed files with 142,249 additions and 144,906 deletions.
8 changes: 4 additions & 4 deletions 04-descriptives.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,7 @@ Ok great. But now I want to create this plot for each `id`... so I have to copy
But copy-pasting is error prone. So there are two alternatives; I either write a function that
takes as argument the data and the `id` I want to plot and run it for each `id` (we will learn to
do this in Chapter 8), or I can use `tidyr::nest()`, combined with `purrr::map()`. `{purrr}` is
another very useful `{tidevyrse}` package, and we are going to learn about it in Chapter 9. Again,
another very useful `{tidyverse}` package, and we are going to learn about it in Chapter 8. Again,
just follow along for now:
```{r}
Expand All @@ -1448,14 +1448,14 @@ my_plots <- nested_survey_data %>%
```
This is some very advanced stuff, and again, do not worry if you don't understand everything now.
We are going to learn about this in detail in Chapter 9. Let's go through each line.
In the first line, I have started from my clean data `nested_survey_data` and then, using the `%>%`
We are going to learn about this in detail in Chapter 8. Let's go through each line.
In the first line, I have started from my clean data `nested_survey_data` and then, using `%>%`
and `mutate()` I create a new column called `plot`. Inside the `mutate()` function, I called `map2`.
`map2` is a `{purrr}` function that takes three inputs: `.x`, `.y` and a function. `.x` is the `id`
column from my data, and `.y` is the `data` column from `nested_survey_data`. The function is the
ggplot I created before. Think of `map2()` has a loop over two lists, all while applying a function.
The following illustration, taken from @vaudor_purrr_2018 by
The following illustration (used with permission), taken from @vaudor_purrr_2018 by
[Lise Vaudor](https://twitter.com/LVaudor), illustrates this perfectly:
```{r, echo=FALSE}
Expand Down
2 changes: 1 addition & 1 deletion 08-functional_programming.Rmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%>% # Functional programming
# Functional programming

Functional programming is a paradigm that I find very suitable for data science. In functional
programming, your code is organised into functions that perform the operations you need. Your scripts
Expand Down
Binary file modified _bookdown_files/modern_R_files/figure-html/unnamed-chunk-78-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _bookdown_files/modern_R_files/figure-html/unnamed-chunk-79-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _bookdown_files/modern_R_files/figure-html/unnamed-chunk-79-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _bookdown_files/modern_R_files/figure-html/unnamed-chunk-86-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _bookdown_files/modern_R_files/figure-html/unnamed-chunk-86-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _bookdown_files/modern_R_files/figure-html/unnamed-chunk-86-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified _bookdown_files/modern_R_files/figure-latex/unnamed-chunk-449-1.pdf
Binary file not shown.
Binary file not shown.
Binary file modified _bookdown_files/modern_R_files/figure-latex/unnamed-chunk-451-1.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2,429 changes: 314 additions & 2,115 deletions docs/defining-your-own-functions.html

Large diffs are not rendered by default.

1,570 changes: 770 additions & 800 deletions docs/descriptive-statistics-and-data-manipulation.html

Large diffs are not rendered by default.

1,110 changes: 588 additions & 522 deletions docs/functional-programming.html

Large diffs are not rendered by default.

101 changes: 52 additions & 49 deletions docs/further-topics.html

Large diffs are not rendered by default.

71 changes: 37 additions & 34 deletions docs/getting-to-know-rstudio.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Bruno Rodrigues" />


<meta name="date" content="2020-06-22" />
<meta name="date" content="2020-11-07" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down Expand Up @@ -344,55 +344,58 @@
<li class="chapter" data-level="" data-path="defining-your-own-functions.html"><a href="defining-your-own-functions.html#exercise-3-3"><i class="fa fa-check"></i>Exercise 3</a></li>
<li class="chapter" data-level="" data-path="defining-your-own-functions.html"><a href="defining-your-own-functions.html#exercise-4-2"><i class="fa fa-check"></i>Exercise 4</a></li>
</ul></li>
<li class="chapter" data-level="7.9" data-path="defining-your-own-functions.html"><a href="defining-your-own-functions.html#function-definitions"><i class="fa fa-check"></i><b>7.9</b> Function definitions</a></li>
<li class="chapter" data-level="7.10" data-path="defining-your-own-functions.html"><a href="defining-your-own-functions.html#properties-of-functions"><i class="fa fa-check"></i><b>7.10</b> Properties of functions</a></li>
<li class="chapter" data-level="7.11" data-path="defining-your-own-functions.html"><a href="defining-your-own-functions.html#functional-programming-with-purrr"><i class="fa fa-check"></i><b>7.11</b> Functional programming with <code>{purrr}</code></a>
</ul></li>
<li class="chapter" data-level="8" data-path="functional-programming.html"><a href="functional-programming.html"><i class="fa fa-check"></i><b>8</b> Functional programming</a>
<ul>
<li class="chapter" data-level="8.1" data-path="functional-programming.html"><a href="functional-programming.html#function-definitions"><i class="fa fa-check"></i><b>8.1</b> Function definitions</a></li>
<li class="chapter" data-level="8.2" data-path="functional-programming.html"><a href="functional-programming.html#properties-of-functions"><i class="fa fa-check"></i><b>8.2</b> Properties of functions</a></li>
<li class="chapter" data-level="8.3" data-path="functional-programming.html"><a href="functional-programming.html#functional-programming-with-purrr"><i class="fa fa-check"></i><b>8.3</b> Functional programming with <code>{purrr}</code></a>
<ul>
<li class="chapter" data-level="7.11.1" data-path="defining-your-own-functions.html"><a href="defining-your-own-functions.html#doing-away-with-loops-the-map-family-of-functions"><i class="fa fa-check"></i><b>7.11.1</b> Doing away with loops: the <code>map*()</code> family of functions</a></li>
<li class="chapter" data-level="7.11.2" data-path="defining-your-own-functions.html"><a href="defining-your-own-functions.html#reducing-with-purrr"><i class="fa fa-check"></i><b>7.11.2</b> Reducing with <code>purrr</code></a></li>
<li class="chapter" data-level="7.11.3" data-path="defining-your-own-functions.html"><a href="defining-your-own-functions.html#error-handling-with-safely-and-possibly"><i class="fa fa-check"></i><b>7.11.3</b> Error handling with <code>safely()</code> and <code>possibly()</code></a></li>
<li class="chapter" data-level="7.11.4" data-path="defining-your-own-functions.html"><a href="defining-your-own-functions.html#partial-applications-with-partial"><i class="fa fa-check"></i><b>7.11.4</b> Partial applications with <code>partial()</code></a></li>
<li class="chapter" data-level="7.11.5" data-path="defining-your-own-functions.html"><a href="defining-your-own-functions.html#function-composition-using-compose"><i class="fa fa-check"></i><b>7.11.5</b> Function composition using <code>compose</code></a></li>
<li class="chapter" data-level="7.11.6" data-path="defining-your-own-functions.html"><a href="defining-your-own-functions.html#transposing-lists"><i class="fa fa-check"></i><b>7.11.6</b> «Transposing lists»</a></li>
<li class="chapter" data-level="8.3.1" data-path="functional-programming.html"><a href="functional-programming.html#doing-away-with-loops-the-map-family-of-functions"><i class="fa fa-check"></i><b>8.3.1</b> Doing away with loops: the <code>map*()</code> family of functions</a></li>
<li class="chapter" data-level="8.3.2" data-path="functional-programming.html"><a href="functional-programming.html#reducing-with-purrr"><i class="fa fa-check"></i><b>8.3.2</b> Reducing with <code>purrr</code></a></li>
<li class="chapter" data-level="8.3.3" data-path="functional-programming.html"><a href="functional-programming.html#error-handling-with-safely-and-possibly"><i class="fa fa-check"></i><b>8.3.3</b> Error handling with <code>safely()</code> and <code>possibly()</code></a></li>
<li class="chapter" data-level="8.3.4" data-path="functional-programming.html"><a href="functional-programming.html#partial-applications-with-partial"><i class="fa fa-check"></i><b>8.3.4</b> Partial applications with <code>partial()</code></a></li>
<li class="chapter" data-level="8.3.5" data-path="functional-programming.html"><a href="functional-programming.html#function-composition-using-compose"><i class="fa fa-check"></i><b>8.3.5</b> Function composition using <code>compose</code></a></li>
<li class="chapter" data-level="8.3.6" data-path="functional-programming.html"><a href="functional-programming.html#transposing-lists"><i class="fa fa-check"></i><b>8.3.6</b> «Transposing lists»</a></li>
</ul></li>
<li class="chapter" data-level="7.12" data-path="defining-your-own-functions.html"><a href="defining-your-own-functions.html#list-based-workflows-for-efficiency"><i class="fa fa-check"></i><b>7.12</b> List-based workflows for efficiency</a>
<li class="chapter" data-level="8.4" data-path="functional-programming.html"><a href="functional-programming.html#list-based-workflows-for-efficiency"><i class="fa fa-check"></i><b>8.4</b> List-based workflows for efficiency</a>
<ul>
<li class="chapter" data-level="7.12.1" data-path="defining-your-own-functions.html"><a href="defining-your-own-functions.html#functional-programming-and-plotting"><i class="fa fa-check"></i><b>7.12.1</b> Functional programming and plotting</a></li>
<li class="chapter" data-level="7.12.2" data-path="defining-your-own-functions.html"><a href="defining-your-own-functions.html#modeling-with-functional-programming"><i class="fa fa-check"></i><b>7.12.2</b> Modeling with functional programming</a></li>
<li class="chapter" data-level="8.4.1" data-path="functional-programming.html"><a href="functional-programming.html#functional-programming-and-plotting"><i class="fa fa-check"></i><b>8.4.1</b> Functional programming and plotting</a></li>
<li class="chapter" data-level="8.4.2" data-path="functional-programming.html"><a href="functional-programming.html#modeling-with-functional-programming"><i class="fa fa-check"></i><b>8.4.2</b> Modeling with functional programming</a></li>
</ul></li>
<li class="chapter" data-level="7.13" data-path="defining-your-own-functions.html"><a href="defining-your-own-functions.html#exercises-6"><i class="fa fa-check"></i><b>7.13</b> Exercises</a>
<li class="chapter" data-level="8.5" data-path="functional-programming.html"><a href="functional-programming.html#exercises-6"><i class="fa fa-check"></i><b>8.5</b> Exercises</a>
<ul>
<li class="chapter" data-level="" data-path="defining-your-own-functions.html"><a href="defining-your-own-functions.html#exercise-1-6"><i class="fa fa-check"></i>Exercise 1</a></li>
<li class="chapter" data-level="" data-path="defining-your-own-functions.html"><a href="defining-your-own-functions.html#exercise-2-4"><i class="fa fa-check"></i>Exercise 2</a></li>
<li class="chapter" data-level="" data-path="functional-programming.html"><a href="functional-programming.html#exercise-1-6"><i class="fa fa-check"></i>Exercise 1</a></li>
<li class="chapter" data-level="" data-path="functional-programming.html"><a href="functional-programming.html#exercise-2-4"><i class="fa fa-check"></i>Exercise 2</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="8" data-path="package-development.html"><a href="package-development.html"><i class="fa fa-check"></i><b>8</b> Package development</a>
<li class="chapter" data-level="9" data-path="package-development.html"><a href="package-development.html"><i class="fa fa-check"></i><b>9</b> Package development</a>
<ul>
<li class="chapter" data-level="8.1" data-path="package-development.html"><a href="package-development.html#why-you-need-to-write-your-own-package"><i class="fa fa-check"></i><b>8.1</b> Why you need to write your own package</a></li>
<li class="chapter" data-level="8.2" data-path="package-development.html"><a href="package-development.html#starting-easy-creating-a-package-to-share-data"><i class="fa fa-check"></i><b>8.2</b> Starting easy: creating a package to share data</a>
<li class="chapter" data-level="9.1" data-path="package-development.html"><a href="package-development.html#why-you-need-to-write-your-own-package"><i class="fa fa-check"></i><b>9.1</b> Why you need to write your own package</a></li>
<li class="chapter" data-level="9.2" data-path="package-development.html"><a href="package-development.html#starting-easy-creating-a-package-to-share-data"><i class="fa fa-check"></i><b>9.2</b> Starting easy: creating a package to share data</a>
<ul>
<li class="chapter" data-level="8.2.1" data-path="package-development.html"><a href="package-development.html#setting-up-a-github-account"><i class="fa fa-check"></i><b>8.2.1</b> Setting up a Github account</a></li>
<li class="chapter" data-level="8.2.2" data-path="package-development.html"><a href="package-development.html#starting-your-package"><i class="fa fa-check"></i><b>8.2.2</b> Starting your package</a></li>
<li class="chapter" data-level="9.2.1" data-path="package-development.html"><a href="package-development.html#setting-up-a-github-account"><i class="fa fa-check"></i><b>9.2.1</b> Setting up a Github account</a></li>
<li class="chapter" data-level="9.2.2" data-path="package-development.html"><a href="package-development.html#starting-your-package"><i class="fa fa-check"></i><b>9.2.2</b> Starting your package</a></li>
</ul></li>
<li class="chapter" data-level="8.3" data-path="package-development.html"><a href="package-development.html#including-data-inside-the-package"><i class="fa fa-check"></i><b>8.3</b> Including data inside the package</a></li>
<li class="chapter" data-level="8.4" data-path="package-development.html"><a href="package-development.html#adding-functions-to-your-package"><i class="fa fa-check"></i><b>8.4</b> Adding functions to your package</a>
<li class="chapter" data-level="9.3" data-path="package-development.html"><a href="package-development.html#including-data-inside-the-package"><i class="fa fa-check"></i><b>9.3</b> Including data inside the package</a></li>
<li class="chapter" data-level="9.4" data-path="package-development.html"><a href="package-development.html#adding-functions-to-your-package"><i class="fa fa-check"></i><b>9.4</b> Adding functions to your package</a>
<ul>
<li class="chapter" data-level="8.4.1" data-path="package-development.html"><a href="package-development.html#one-function-inside-one-script"><i class="fa fa-check"></i><b>8.4.1</b> One function inside one script</a></li>
<li class="chapter" data-level="8.4.2" data-path="package-development.html"><a href="package-development.html#many-functions-inside-a-script"><i class="fa fa-check"></i><b>8.4.2</b> Many functions inside a script</a></li>
<li class="chapter" data-level="9.4.1" data-path="package-development.html"><a href="package-development.html#one-function-inside-one-script"><i class="fa fa-check"></i><b>9.4.1</b> One function inside one script</a></li>
<li class="chapter" data-level="9.4.2" data-path="package-development.html"><a href="package-development.html#many-functions-inside-a-script"><i class="fa fa-check"></i><b>9.4.2</b> Many functions inside a script</a></li>
</ul></li>
<li class="chapter" data-level="8.5" data-path="package-development.html"><a href="package-development.html#documenting-your-package"><i class="fa fa-check"></i><b>8.5</b> Documenting your package</a>
<li class="chapter" data-level="9.5" data-path="package-development.html"><a href="package-development.html#documenting-your-package"><i class="fa fa-check"></i><b>9.5</b> Documenting your package</a>
<ul>
<li class="chapter" data-level="8.5.1" data-path="package-development.html"><a href="package-development.html#description"><i class="fa fa-check"></i><b>8.5.1</b> Description</a></li>
<li class="chapter" data-level="9.5.1" data-path="package-development.html"><a href="package-development.html#description"><i class="fa fa-check"></i><b>9.5.1</b> Description</a></li>
</ul></li>
<li class="chapter" data-level="8.6" data-path="package-development.html"><a href="package-development.html#unit-testing-your-package"><i class="fa fa-check"></i><b>8.6</b> Unit testing your package</a></li>
<li class="chapter" data-level="9.6" data-path="package-development.html"><a href="package-development.html#unit-testing-your-package"><i class="fa fa-check"></i><b>9.6</b> Unit testing your package</a></li>
</ul></li>
<li class="chapter" data-level="9" data-path="further-topics.html"><a href="further-topics.html"><i class="fa fa-check"></i><b>9</b> Further topics</a>
<li class="chapter" data-level="10" data-path="further-topics.html"><a href="further-topics.html"><i class="fa fa-check"></i><b>10</b> Further topics</a>
<ul>
<li class="chapter" data-level="9.1" data-path="further-topics.html"><a href="further-topics.html#using-python-from-r-with-reticulate"><i class="fa fa-check"></i><b>9.1</b> Using Python from R with <code>{reticulate}</code></a></li>
<li class="chapter" data-level="9.2" data-path="further-topics.html"><a href="further-topics.html#generating-pdf-or-word-reports-with-r"><i class="fa fa-check"></i><b>9.2</b> Generating Pdf or Word reports with R</a></li>
<li class="chapter" data-level="9.3" data-path="further-topics.html"><a href="further-topics.html#scraping-the-internet"><i class="fa fa-check"></i><b>9.3</b> Scraping the internet</a></li>
<li class="chapter" data-level="9.4" data-path="further-topics.html"><a href="further-topics.html#regular-expressions"><i class="fa fa-check"></i><b>9.4</b> Regular expressions</a></li>
<li class="chapter" data-level="9.5" data-path="further-topics.html"><a href="further-topics.html#setting-up-a-blog-with-blogdown"><i class="fa fa-check"></i><b>9.5</b> Setting up a blog with <code>{blogdown}</code></a></li>
<li class="chapter" data-level="10.1" data-path="further-topics.html"><a href="further-topics.html#using-python-from-r-with-reticulate"><i class="fa fa-check"></i><b>10.1</b> Using Python from R with <code>{reticulate}</code></a></li>
<li class="chapter" data-level="10.2" data-path="further-topics.html"><a href="further-topics.html#generating-pdf-or-word-reports-with-r"><i class="fa fa-check"></i><b>10.2</b> Generating Pdf or Word reports with R</a></li>
<li class="chapter" data-level="10.3" data-path="further-topics.html"><a href="further-topics.html#scraping-the-internet"><i class="fa fa-check"></i><b>10.3</b> Scraping the internet</a></li>
<li class="chapter" data-level="10.4" data-path="further-topics.html"><a href="further-topics.html#regular-expressions"><i class="fa fa-check"></i><b>10.4</b> Regular expressions</a></li>
<li class="chapter" data-level="10.5" data-path="further-topics.html"><a href="further-topics.html#setting-up-a-blog-with-blogdown"><i class="fa fa-check"></i><b>10.5</b> Setting up a blog with <code>{blogdown}</code></a></li>
</ul></li>
<li class="chapter" data-level="" data-path="references.html"><a href="references.html"><i class="fa fa-check"></i>References</a></li>
<li class="divider"></li>
Expand Down
Loading

0 comments on commit 0ba7370

Please sign in to comment.