Skip to content
This repository was archived by the owner on Jan 4, 2023. It is now read-only.

Commit 44663f4

Browse files
davidrubingerhadley
authored andcommittedJun 20, 2018
Fix typos and formatting (hadley#670)
1 parent 03c4cc5 commit 44663f4

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed
 

‎functions.Rmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ if (condition) {
280280

281281
To get help on `if` you need to surround it in backticks: `` ?`if` ``. The help isn't particularly helpful if you're not already an experienced programmer, but at least you know how to get to it!
282282

283-
Here's a simple function that uses an if statement. The goal of this function is to return a logical vector describing whether or not each element of a vector is named.
283+
Here's a simple function that uses an `if` statement. The goal of this function is to return a logical vector describing whether or not each element of a vector is named.
284284

285285
```{r}
286286
has_name <- function(x) {

‎pipes.Rmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ foo_foo %>%
131131
bop(on = head)
132132
```
133133

134-
This is my favourite form, because it focusses on verbs, not nouns. You can read this series of function compositions like it's a set of imperative actions. Foo Foo hops, then scoops, then bops. The downside, of course, is that you need to be familiar with the pipe. If you've never seen `%>%` before, you'll have no idea what this code does. Fortunately, most people pick up the idea very quickly, so when you share you code with others who aren't familiar with the pipe, you can easily teach them.
134+
This is my favourite form, because it focusses on verbs, not nouns. You can read this series of function compositions like it's a set of imperative actions. Foo Foo hops, then scoops, then bops. The downside, of course, is that you need to be familiar with the pipe. If you've never seen `%>%` before, you'll have no idea what this code does. Fortunately, most people pick up the idea very quickly, so when you share your code with others who aren't familiar with the pipe, you can easily teach them.
135135

136136
The pipe works by performing a "lexical transformation": behind the scenes, magrittr reassembles the code in the pipe to a form that works by overwriting an intermediate object. When you run a pipe like the one above, magrittr does something like this:
137137

‎vectors.Rmd

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Every vector has two key properties:
4848
length(x)
4949
```
5050
51-
Vectors can also contain arbitrary additional metadata in the form of attributes. These attributes are used to create __augmented vectors__ which build on additional behaviour. There are four important types of augmented vector:
51+
Vectors can also contain arbitrary additional metadata in the form of attributes. These attributes are used to create __augmented vectors__ which build on additional behaviour. There are three important types of augmented vector:
5252
5353
* Factors are built on top of integer vectors.
5454
* Dates and date-times are built on top of numeric vectors.
@@ -194,7 +194,7 @@ There are two ways to convert, or coerce, one type of vector to another:
194194

195195
Because explicit coercion is used relatively rarely, and is largely easy to understand, I'll focus on implicit coercion here.
196196

197-
You've already seen the most important type of implicit coercion: using a logical vector in a numeric context. In this case `TRUE` is converted to `1` and `FALSE` converted to 0. That means the sum of a logical vector is the number of trues, and the mean of a logical vector is the proportion of trues:
197+
You've already seen the most important type of implicit coercion: using a logical vector in a numeric context. In this case `TRUE` is converted to `1` and `FALSE` converted to `0`. That means the sum of a logical vector is the number of trues, and the mean of a logical vector is the proportion of trues:
198198

199199
```{r}
200200
x <- sample(20, 100, replace = TRUE)

0 commit comments

Comments
 (0)
This repository has been archived.