Skip to content

Commit 27d5897

Browse files
committed
assorted typos
1 parent 0b125e7 commit 27d5897

12 files changed

Lines changed: 29 additions & 29 deletions

episodes/01-starting-with-data.Rmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ read.csv(file = "data/inflammation-01.csv", header = FALSE)
8888
The expression `read.csv(...)` is a [function call](../learners/reference.md#function-call) that asks R to run the function `read.csv`.
8989

9090
`read.csv` has two [arguments](../learners/reference.md#argument): the name of the file we want to read, and whether the first line of the file contains names for the columns of data.
91-
The filename needs to be a character string (or [string](../learners/reference.md#string)for short), so we put it in quotes.
91+
The filename needs to be a character string (or [string](../learners/reference.md#string) for short), so we put it in quotes.
9292
Assigning the second argument, `header`, to be `FALSE` indicates that the data file does not have column headers.
9393
We'll talk more about the value `FALSE`, and its converse `TRUE`, in lesson 04.
9494
In case of our `inflammation-01.csv` example, R auto-generates column names in the sequence `V1` (for "variable 1"), `V2`, and so on, until `V40`.
@@ -334,7 +334,7 @@ dim(dat)
334334

335335
This tells us that our data frame, `dat`, has `r nrow(dat)` rows and `r ncol(dat)` columns.
336336

337-
If we want to get a single value from the data frame, we can provide an [index](../learners/reference.md#index)in square brackets.
337+
If we want to get a single value from the data frame, we can provide an [index](../learners/reference.md#index) in square brackets.
338338
The first number specifies the row and the second the column:
339339

340340
```{r selecting data frame elements}
@@ -466,7 +466,7 @@ sd(dat[, 7])
466466

467467
## Forcing Conversion
468468

469-
Note that R may return an error when you attempt to perform similar calculations on subsetted *rows*of data frames.
469+
Note that R may return an error when you attempt to perform similar calculations on subsetted *rows* of data frames.
470470
This is because some functions in R automatically convert the object type to a numeric vector, while others do not (e.g. `max(dat[1, ])` works as expected, while `mean(dat[1, ])` returns `NA` and a warning).
471471
You get the expected output by including an explicit call to `as.numeric()`, e.g. `mean(as.numeric(dat[1, ]))`.
472472
By contrast, calculations on subsetted *columns* always work as expected, since columns of data frames are already defined as vectors.

episodes/02-func-R.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ z
266266
center(z, 3)
267267
```
268268

269-
That looks right, so let's try center on our real data.
269+
That looks right, so let's try `center` on our real data.
270270
We'll center the inflammation data from day 4 around 0:
271271

272272
```{r}

episodes/03-loops-R.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ print_words(best_practice[-6])
9292

9393
## Not Available
9494

95-
R has has a special variable, `NA`, for designating missing values that are **N**ot **A**vailable in a data set.
95+
R has a special variable, `NA`, for designating missing values that are **N**ot **A**vailable in a data set.
9696
See `?NA` and [An Introduction to R][na] for more details.
9797

9898
::::::::::::::::::::::::::::::::::::::::::::::::::

episodes/04-cond.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ When `use_boxplot` is set to `FALSE`, `plot_dist` will instead plot a histogram
280280
As before, if the length of the vector is shorter than `threshold`, `plot_dist` will create a stripchart.
281281
A histogram is made with the `hist` command in R.
282282

283-
```{r conditional-challenge-hist, fig.alt=c("A grey unlabeled boxplot chart showing the distrubution values between 2 and 9 with a mean at 6.", "A grey unlabeled histogram showing bimodal distribution between 2 and 9 with peaks at 2 and 6.", "A mostly blank strip chart showing five points at 3, 4, 6, 7, and 9"), echo=-1}
283+
```{r conditional-challenge-hist, fig.alt=c("A grey unlabeled boxplot chart showing the distribution of values between 2 and 9 with a mean at 6.", "A grey unlabeled histogram showing bimodal distribution between 2 and 9 with peaks at 2 and 6.", "A mostly blank strip chart showing five points at 3, 4, 6, 7, and 9"), echo=-1}
284284
plot_dist <- function(x, threshold, use_boxplot = TRUE) {
285285
if (length(x) > threshold && use_boxplot) {
286286
boxplot(x)

episodes/06-best-practices-R.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ library(reshape)
5252
library(vegan)
5353
```
5454

55-
Another way you can be explicit about the requirements of your code and improve it's reproducibility is to limit the "hard-coding" of the input and output files for your script.
55+
Another way you can be explicit about the requirements of your code and improve its reproducibility is to limit the "hard-coding" of the input and output files for your script.
5656
If your code will read in data from a file, define a variable early in your code that stores the path to that file.
5757
For example
5858

@@ -111,7 +111,7 @@ It's easy to annotate and mark your code using `#` or `#-`to set off sections of
111111
For example, it's often helpful when writing code to separate the function definitions.
112112
If you create only one or a few custom functions in your script, put them toward the top of your code.
113113
If you have written many functions, put them all in their own .
114-
R file and then` source` those files. `source` will define all of these functions so that your code can make use of them as needed.
114+
R file and then `source` those files. `source` will define all of these functions so that your code can make use of them as needed.
115115

116116
```{r source_ex, eval=FALSE}
117117
source("my_genius_fxns.R")

episodes/08-making-packages-R.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ We will use the [devtools] and [roxygen2] packages, which make creating packages
100100
Both can be installed from CRAN like this:
101101

102102
```{r, eval=FALSE}
103-
install.packages(c("devtools", "roxygen2")) # installations can be `c`ombined
103+
install.packages(c("devtools", "roxygen2")) # installations can be combined
104104
library("devtools")
105105
library("roxygen2")
106106
```

episodes/10-supp-addressing-data.Rmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ There are three main ways for addressing data inside R objects.
3232
- By logical vector
3333
- By name
3434

35-
Lets start by loading some sample data:
35+
Let's start by loading some sample data:
3636

3737
```{r readData}
3838
dat <- read.csv(file = 'data/sample.csv', header = TRUE, stringsAsFactors = FALSE)
@@ -49,7 +49,7 @@ Using factors in R is covered in a separate lesson.
4949

5050
::::::::::::::::::::::::::::::::::::::::::::::::::
5151

52-
Lets take a look at this data.
52+
Let's take a look at this data.
5353

5454
```{r classDat}
5555
class(dat)
@@ -63,8 +63,8 @@ We can compactly display the internal structure of a data frame using the struc
6363
str(dat)
6464
```
6565

66-
The `str` function tell us that the data has 100 rows and 9 columns.
67-
It is also tell us that the data frame is made up of character `chr`, integer `int` and `numeric` vectors.
66+
The `str` function tells us that the data has 100 rows and 9 columns.
67+
It is also tells us that the data frame is made up of character `chr`, integer `int` and `numeric` vectors.
6868

6969
```{r headDat}
7070
head(dat)

episodes/11-supp-read-write-csv.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ library(svglite)
2828

2929
The most common way that scientists store data is in Excel spreadsheets.
3030
While there are R packages designed to access data from Excel spreadsheets (e.g., gdata, RODBC, XLConnect, xlsx, RExcel), users often find it easier to save their spreadsheets in [comma-separated values](reference.html#comma-separated-values-csv) files (CSV) and then use R's built in functionality to read and manipulate the data.
31-
In this short lesson, we'll learn how to read data from a .csv and write to a new .csv, and explore the [arguments](../learners/reference.md#argument) that allow you read and write the data correctly for your needs.
31+
In this short lesson, we'll learn how to read data from a .csv and write to a new .csv, and explore the [arguments](../learners/reference.md#argument) that allow you to read and write the data correctly for your needs.
3232

3333
### Read a .csv and Explore the Arguments
3434

3535
Let's start by opening a .csv file containing information on the speeds at which cars of different colors were clocked in 45 mph zones in the four-corners states (`car-speeds.csv`).
36-
We will use the built in `read.csv(...)` [function call](../learners/reference.md#function-call), which reads the data in as a data frame, and assign the data frame to a variable (using `<-`) so that it is stored in R's memory.
36+
We will use the built in `read.csv(...)` [function call](../learners/reference.md#function-call), which reads the data in as a data frame, and assigns the data frame to a variable (using `<-`) so that it is stored in R's memory.
3737
Then we will explore some of the basic arguments that can be supplied to the function.
3838
First, open the RStudio project containing the scripts and data you were working on in episode 'Analyzing Patient Data'.
3939

episodes/12-supp-factors.Rmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ Factors can be ordered or unordered and are an important class for statistical a
3333
Factors are stored as integers, and have labels associated with these unique integers.
3434
While factors look (and often behave) like character vectors, they are actually integers under the hood, and you need to be careful when treating them like strings.
3535

36-
Once created, factors can only contain a pre-defined set values, known as *levels*.
37-
By default, R always sorts*levels*in alphabetical order.
36+
Once created, factors can only contain a pre-defined set of values, known as *levels*.
37+
By default, R always sorts *levels* in alphabetical order.
3838
For instance, if you have a factor with 2 levels:
3939

4040
::::::::::::::::::::::::::::::::::::::::: callout
@@ -57,7 +57,7 @@ levels(sex)
5757
nlevels(sex)
5858
```
5959

60-
Sometimes, the order of the factors does not matter, other times you might want to specify the order because it is meaningful (e.g., "low", "medium", "high") or it is required by particular type of analysis.
60+
Sometimes, the order of the factors does not matter, other times you might want to specify the order because it is meaningful (e.g., "low", "medium", "high") or it is required by a particular type of analysis.
6161
Additionally, specifying the order of the levels allows us to compare levels:
6262

6363
```{r, error=TRUE}

episodes/13-supp-data-structures.Rmd

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ mdat[2, 3]
363363

364364
In R lists act as containers.
365365
Unlike atomic vectors, the contents of a list are not restricted to a single mode and can encompass any mixture of data types.
366-
Lists are sometimes called generic vectors, because the elements of a list can by of any type of R object, even lists containing further lists.
366+
Lists are sometimes called generic vectors, because the elements of a list can be of any type of R object, even lists containing further lists.
367367
This property makes them fundamentally different from atomic vectors.
368368

369369
A list is a special type of vector.
@@ -461,18 +461,18 @@ If the elements of a list are named, they can be referenced by the `$` notation
461461
A data frame is a very important data type in R.
462462
It's pretty much the *de facto* data structure for most tabular data and what we use for statistics.
463463

464-
A data frame is a *special type of list* where every element of the list has same length (i.e. data frame is a "rectangular" list).
464+
A data frame is a *special type of list* where every element of the list has the same length (i.e. data frame is a "rectangular" list).
465465

466466
Data frames can have additional attributes such as `rownames()`, which can be useful for annotating data, like `subject_id` or `sample_id`.
467467
But most of the time they are not used.
468468

469469
Some additional information on data frames:
470470

471471
- Usually created by `read.csv()` and `read.table()`, i.e. when importing the data into R.
472-
- Assuming all columns in a data frame are of same type, data frame can be converted to a matrix with data.matrix() (preferred) or as.matrix(). Otherwise type coercion will be enforced and the results may not always be what you expect.
472+
- Assuming all columns in a data frame are of the same type, data frame can be converted to a matrix with data.matrix() (preferred) or as.matrix(). Otherwise type coercion will be enforced and the results may not always be what you expect.
473473
- Can also create a new data frame with `data.frame()` function.
474474
- Find the number of rows and columns with `nrow(dat)` and `ncol(dat)`, respectively.
475-
- Rownames are often automatically generated and look like 1, 2, ..., n. Consistency in numbering of rownames may not be honored when rows are reshuffled or subset.
475+
- Row names are often automatically generated and look like 1, 2, ..., n. Consistency in numbering of rownames may not be honored when rows are reshuffled or subset.
476476

477477
### Creating Data Frames by Hand
478478

@@ -518,7 +518,7 @@ dat[["y"]]
518518
dat$y
519519
```
520520

521-
The following table summarizes the one-dimensional and two-dimensional data structures in R in relation to diversity of data types they can contain.
521+
The following table summarizes the one-dimensional and two-dimensional data structures in R in relation to the diversity of data types they can contain.
522522

523523
| Dimensions | Homogenous | Heterogeneous |
524524
| ---------- | ------------- | ------------- |
@@ -528,7 +528,7 @@ The following table summarizes the one-dimensional and two-dimensional data stru
528528
::::::::::::::::::::::::::::::::::::::::: callout
529529

530530
Lists can contain elements that are themselves muti-dimensional (e.g. a lists can contain data frames or another type of objects).
531-
Lists can also contain elements of any length, therefore list do not necessarily have to be "rectangular".
531+
Lists can also contain elements of any length, therefore lists do not necessarily have to be "rectangular".
532532
However in order for the list to qualify as a data frame, the length of each element has to be the same.
533533

534534
::::::::::::::::::::::::::::::::::::::::::::::::::
@@ -537,7 +537,7 @@ However in order for the list to qualify as a data frame, the length of each ele
537537

538538
## Column Types in Data Frames
539539

540-
Knowing that data frames are lists, can columns be of different type?
540+
Knowing that data frames are lists, can columns be of different types?
541541

542542
What type of structure do you expect to see when you explore the structure of the `PlantGrowth` data frame?
543543
Hint: Use `str()`.

0 commit comments

Comments
 (0)