From 144382510ef0de32c1033fd7895630d035fe130a Mon Sep 17 00:00:00 2001 From: Curtis Alexander Date: Wed, 23 Mar 2016 09:41:34 -0500 Subject: [PATCH 1/4] typos --- iteration.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iteration.Rmd b/iteration.Rmd index 70583e1..ded5952 100644 --- a/iteration.Rmd +++ b/iteration.Rmd @@ -509,7 +509,7 @@ Never feel bad about using a for loop instead of a function. The map functions a ### Shortcuts -There are a few shortcuts that you can use with `.f` in order to save a little typing. Imagine you want to fit a linear model to each group in a dataset. The following toy example splits the up the `mtcars` dataset in to three pieces (one for each value of cylinder) and fits the same linear model to each piece: +There are a few shortcuts that you can use with `.f` in order to save a little typing. Imagine you want to fit a linear model to each group in a dataset. The following toy example splits up the `mtcars` dataset into three pieces (one for each value of cylinder) and fits the same linear model to each piece: ```{r} models <- mtcars %>% From d44c641c3f45b6b5323eaa80d4453c0ff5493a7f Mon Sep 17 00:00:00 2001 From: Ian Lyttle Date: Sun, 27 Mar 2016 15:26:57 -0500 Subject: [PATCH 2/4] just a couple of typos --- iteration.Rmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iteration.Rmd b/iteration.Rmd index bd7e004..d9b2b78 100644 --- a/iteration.Rmd +++ b/iteration.Rmd @@ -17,7 +17,7 @@ In [functions], we talked about how important it is to reduce duplication in you 1. You're likely to have fewer bugs because each line of code is used in more places. -One part of reducing duplication is writing functions. Functions allow you to identify repeated patterns of code and extract them out into indepdent pieces that you can reuse and easily update as code changes. Iteration helps you when you need to do the same thing to multiple inputs: repeating the same operation on different columns, or on different datasets. (Generally, you won't need to use explicit iteration to deal with different subsets of your data: in most cases the implicit iteration in dplyr will take care of that problem for you.) +One part of reducing duplication is writing functions. Functions allow you to identify repeated patterns of code and extract them out into independent pieces that you can reuse and easily update as code changes. Iteration helps you when you need to do the same thing to multiple inputs: repeating the same operation on different columns, or on different datasets. (Generally, you won't need to use explicit iteration to deal with different subsets of your data: in most cases the implicit iteration in dplyr will take care of that problem for you.) In this chapter you'll learn about two important iteration paradigms: imperative programming and functional programming, and the machinary each provides. On the imperative side you have things like for loops and while loops, which are a great place to start because they make iteration very explicit, so it's obvious what's happening. However, for loops are quite verbose, and include quite a bit of book-keeping code, that is duplicated for every for loop. Functional programming (FP) offers tools to extract out this duplicated code, so each common for loop pattern gets its own function. Once you master the vocabulary of FP, you can solve many common iteration problems with less code, more ease, and fewer errors. @@ -114,7 +114,7 @@ That's all there is to the for loop! Now is a good time to practice creating som 1. Compute the mean of every column in the `mtcars`. 1. Determine the type of each column in `nycflights13::flights`. 1. Compute the number of unique values in each column of `iris`. - 1. Generate 10 random normals for each of $mu = -10$, $0$, $10$, and $100$. + 1. Generate 10 random normals for each of $\mu = -10$, $0$, $10$, and $100$. Think about output, sequence, and body, __before__ you start writing the loop. From 03e81bfee67284b920edf1980bed5edea3b9b937 Mon Sep 17 00:00:00 2001 From: OaCantona Date: Mon, 25 Apr 2016 08:39:48 +0200 Subject: [PATCH 3/4] Typo --- datetimes.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datetimes.Rmd b/datetimes.Rmd index 65ca13d..5baf26b 100644 --- a/datetimes.Rmd +++ b/datetimes.Rmd @@ -400,7 +400,7 @@ datetimes %>% ### Setting dates -You can also use each accessor funtion to set the components of a date or datetime. +You can also use each accessor function to set the components of a date or datetime. ```{r} datetime From 759a767ab560eb95c80f197997fa7c51c2ee9e95 Mon Sep 17 00:00:00 2001 From: adi pradhan Date: Tue, 10 May 2016 16:19:49 -0400 Subject: [PATCH 4/4] 'plce' corrected to 'place' --- visualize.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/visualize.Rmd b/visualize.Rmd index 484f604..43a403f 100644 --- a/visualize.Rmd +++ b/visualize.Rmd @@ -156,7 +156,7 @@ ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy), color = "blue") ``` -Here, the color doesn't convey information about a variable. It only changes the appearance of the plot. To set an aesthetic manually, do not plce it in the `aes()` function. Call the aesthetic by name as an argument of your geom function. Then pass the aesthetic a value that R will recognize, such as +Here, the color doesn't convey information about a variable. It only changes the appearance of the plot. To set an aesthetic manually, do not place it in the `aes()` function. Call the aesthetic by name as an argument of your geom function. Then pass the aesthetic a value that R will recognize, such as * the name of a color as a character string * the size of a point as a cex expansion factor (see `?par`)