Skip to content

Commit 1569852

Browse files
committed
typos typos typos
1 parent 0e077d0 commit 1569852

File tree

79 files changed

+1758
-627
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1758
-627
lines changed

0_01_R_and_RStudio.Rmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ R is not just about data analysis---though we will mostly use it this way. It is
1616

1717
### Getting and installing R {-}
1818

19-
R is open source, meaning anyone can download the source code -- the collection of computer instructions that define R -- and assuming they have enough time, energy and expertise, they are free to alter it as they please. Open source does not _necessarily_ mean free, as in it costs £0 to download and use, but luckily R _is_ free in this sense. If you are working on the University managed desktops it should already have been installed and is ready for you to use. We encourage you to install a copy on your own laptop so that you can work at home, in the library, at a café, or wherever else you find you are productive. Do not use R on its own though. Use it in combination with the RStudio IDE discussed in the next section.
19+
R is open source, meaning anyone can download the source code -- the collection of computer instructions that define R -- and assuming they have enough time, energy and expertise, they are free to alter it as they please. Open source does not _necessarily_ mean free, as in it costs £0 to download and use, but luckily R _is_ free in this sense. If you're working on the University managed desktops it should already have been installed and is ready for you to use. We encourage you to install a copy on your own laptop so that you can work at home, in the library, at a café, or wherever else you find you are productive. Do not use R on its own though. Use it in combination with the RStudio IDE discussed in the next section.
2020

2121
In order to install R you need to download the appropriate installer from the Comprehensive R Archive Network ([CRAN](http://cran.r-project.org)). We are going to use the "base distribution" as this contains everything you need to use R under normal circumstances. There is a single [installer](http://cran.r-project.org/bin/windows/base/) for Windows. On a Mac, it's important to match the [installer](http://cran.r-project.org/bin/macosx/) to the version of OS X. In either case, R uses a the standard install mechanism that should be familiar to anyone who has installed an application on their machine. There is no need to change the default settings---doing so will probably lead to problems later on.
2222

1_03_building_scripts.Rmd

+26-28
Large diffs are not rendered by default.

1_04_functions.Rmd

+20-21
Large diffs are not rendered by default.

1_05_numeric_vectors.Rmd

+4-4
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ c(vec1, vec2)
7474
```
7575
This shows that we can use the `c` function to concatenate ("stick together") two or more vectors, even if they are not of length 1. We combined a length-2 vector with a length-3 vector to produce a new length-5 vector.
7676

77-
Notice that we did not have to name the arguments in those two examples---there were no `=` involved. The `c` function is an example of one of those flexible functions that breaks the simple rules of thumb for using arguments that we set out earlier: it can take a variable number of arguments, and these arguments do not have predefined names. This behaviour is necessary if you think about how `c` has to work: in order to be useful it needs to be flexible enough to take any combination of arguments.
77+
Notice that we did not have to name the arguments in those two examples---there were no `=` involved. The `c` function is an example of one of those flexible functions that breaks the simple rules of thumb for using arguments that we set out earlier: it can take a variable number of arguments, and these arguments do not have predefined names. This behaviour is necessary for `c` to be of any use: in order to be useful it needs to be flexible enough to take any combination of arguments.
7878

7979
```{block, type="info"}
8080
#### Finding out about a vector R
@@ -111,7 +111,7 @@ This is fairly self-explanatory. The `seq` function constructed a numeric vector
111111
```{r}
112112
seq(from = 0, to = 11, by = 2)
113113
```
114-
You can generate a descending sequence by using a negative `by` value, like this:
114+
We can generate a descending sequence by using a negative `by` value, like this:
115115
```{r}
116116
seq(from = 12, to = 0, by = -2)
117117
```
@@ -139,7 +139,7 @@ When we leave out the name of the third argument its value is position matched t
139139
```{r}
140140
seq(0, 12, 2)
141141
```
142-
However, our advice is to explicitly name the `by` argument instead of relying on position matching, because this will remind you what you're doing and will stop you forgetting about the different control arguments.
142+
However, our advice is to explicitly name the `by` argument instead of relying on position matching, because this reminds us what we're doing and will stop us forgetting about the different control arguments.
143143

144144
If we do not specify values of either `by`, `length.out` and `along.with` when using `seq` the default behaviour is to assume we meant `by = 1`:
145145
```{r}
@@ -176,7 +176,7 @@ Predictably, we can also use both the `times` and `each` arguments together if w
176176
seqvec <- 1:4
177177
rep(seqvec, times = 3, each = 2)
178178
```
179-
The way to think about how this works is to imagine that you apply `rep` twice, first with `each = 2`, then with `times = 3` (or vice versa). We can achieve the same thing using nested function calls, though it is much uglier:
179+
The way to think about how this works is to imagine that we apply `rep` twice, first with `each = 2`, then with `times = 3` (or vice versa). We can achieve the same thing using nested function calls, though it is much uglier:
180180
```{r}
181181
seqvec <- 1:4
182182
rep(rep(seqvec, each = 2), times = 3)

1_06_more_vectors.Rmd

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ What about the `seq` function? Hopefully it is fairly obvious that we can't use
4646

4747
## Logical vectors
4848

49-
The elements of __logical vectors__ only take two values: `TRUE` or `FALSE`. Don't let the simplicity of logical vectors fool you---they're very useful. As with other kinds of atomic vectors the `c` and `rep` functions can be used to construct a logical vector:
49+
The elements of __logical vectors__ only take two values: `TRUE` or `FALSE`. Don't let the simplicity of logical vectors fool you. They're very useful. As with other kinds of atomic vectors the `c` and `rep` functions can be used to construct a logical vector:
5050
```{r}
5151
l_vec <- c(TRUE, FALSE)
5252
rep(l_vec, times = 2)
@@ -75,7 +75,7 @@ Now, if we need to evaluate and represent a question like, "is x greater than th
7575
```{r}
7676
x > y
7777
```
78-
What do you notice about this simple example? The `x > y` expression produces a logical vector, with `TRUE` values associated with elements in `x` are less than `y`, and `FALSE` otherwise. In this example, x is less than y until we reach the value of 15 in each sequence. Notice that that relational operators are vectorised: the work on an element by element basis. They wouldn't be much use if this were not the case.
78+
The `x > y` expression produces a logical vector, with `TRUE` values associated with elements in `x` are less than `y`, and `FALSE` otherwise. In this example, x is less than y until we reach the value of 15 in each sequence. Notice that that relational operators are vectorised: the work on an element by element basis. They wouldn't be much use if this were not the case.
7979

8080
What does the `==` operator do? It compares the elements of two vectors to determine if they are exactly equal:
8181
```{r}

0 commit comments

Comments
 (0)