Fix code formatting

This commit is contained in:
mine-cetinkaya-rundel 2023-05-25 23:26:36 -04:00
parent 77c95b7c0c
commit c5b7811645
1 changed files with 2 additions and 2 deletions

View File

@ -428,7 +428,7 @@ The final member of the apply family is the titular `apply()`, which works with
In particular, watch out for `apply(df, 2, something)`, which is a slow and potentially dangerous way of doing `lapply(df, something)`. In particular, watch out for `apply(df, 2, something)`, which is a slow and potentially dangerous way of doing `lapply(df, something)`.
This rarely comes up in data science because we usually work with data frames and not matrices. This rarely comes up in data science because we usually work with data frames and not matrices.
## For loops ## `for` loops
`for` loops are the fundamental building block of iteration that both the apply and map families use under the hood. `for` loops are the fundamental building block of iteration that both the apply and map families use under the hood.
`for` loops are powerful and general tools that are important to learn as you become a more experienced R programmer. `for` loops are powerful and general tools that are important to learn as you become a more experienced R programmer.
@ -443,7 +443,7 @@ for (element in vector) {
``` ```
The most straightforward use of `for` loops is to achieve the same effect as `walk()`: call some function with a side-effect on each element of a list. The most straightforward use of `for` loops is to achieve the same effect as `walk()`: call some function with a side-effect on each element of a list.
For example, in @sec-save-database instead of using walk: For example, in @sec-save-database instead of using `walk()`:
```{r} ```{r}
#| eval: false #| eval: false