Improve sentences (#1279)
It slightly improves sentences and fixes some typos.
This commit is contained in:
parent
b0a395b477
commit
61a4ce719d
|
@ -502,7 +502,7 @@ We'll use `tibble()` and `tribble()` later in the book to construct small exampl
|
|||
|
||||
In this chapter, you've learned how to load CSV files with `read_csv()` and to do your own data entry with `tibble()` and `tribble()`.
|
||||
You've learned how csv files work, some of the problems you might encounter, and how to overcome them.
|
||||
We'll come to data import a few times in this book: @sec-import-spreadsheets from Excel and googlesheets, @sec-import-databases will show you how to load data from databases, @sec-arrow from parquet files, @sec-rectangling from JSON, and @sec-scraping from websites.
|
||||
We'll come to data import a few times in this book: @sec-import-spreadsheets from Excel and Google Sheets, @sec-import-databases will show you how to load data from databases, @sec-arrow from parquet files, @sec-rectangling from JSON, and @sec-scraping from websites.
|
||||
|
||||
Now that you're writing a substantial amount of R code, it's time to learn more about organizing your code into files and directories.
|
||||
In the next chapter, you'll learn all about the advantages of scripts and projects, and some of the many tools that they provide to make your life easier.
|
||||
|
|
|
@ -397,7 +397,7 @@ household
|
|||
```
|
||||
|
||||
This dataset contains data about five families, with the names and dates of birth of up to two children.
|
||||
The new challenge in this dataset is that the column names contain the names of two variables (`dob`, `name)` and the values of another (`child,` with values 1 and 2).
|
||||
The new challenge in this dataset is that the column names contain the names of two variables (`dob`, `name)` and the values of another (`child,` with values 1 or 2).
|
||||
To solve this problem we again need to supply a vector to `names_to` but this time we use the special `".value"` sentinel.
|
||||
This overrides the usual `values_to` argument to use the first component of the pivoted column name as a variable name in the output.
|
||||
|
||||
|
|
|
@ -278,7 +278,7 @@ flights |>
|
|||
|
||||
The `.` is a sign that `.before` is an argument to the function, not the name of a new variable.
|
||||
You can also use `.after` to add after a variable, and in both `.before` and `.after` you can use the variable name instead of a position.
|
||||
For example, we could add the new variables after `day:`
|
||||
For example, we could add the new variables after `day`:
|
||||
|
||||
```{r}
|
||||
flights |>
|
||||
|
@ -307,7 +307,7 @@ flights |>
|
|||
It's not uncommon to get datasets with hundreds or even thousands of variables.
|
||||
In this situation, the first challenge is often just focusing on the variables you're interested in.
|
||||
`select()` allows you to rapidly zoom in on a useful subset using operations based on the names of the variables.
|
||||
`select()` is not terribly useful with the flights data because we only have 19 variables, but you can still get the general idea of how it works:
|
||||
`select()` is not terribly useful with the `flights` data because we only have 19 variables, but you can still get the general idea of how it works:
|
||||
|
||||
```{r}
|
||||
# Select columns by name
|
||||
|
|
|
@ -473,7 +473,7 @@ ggplot(penguins, aes(x = flipper_length_mm, y = body_mass_g)) +
|
|||
geom_point()
|
||||
```
|
||||
|
||||
In the future, you'll also learn about the pipe which will allow you to create that plot with:
|
||||
In the future, you'll also learn about the pipe, `|>`, which will allow you to create that plot with:
|
||||
|
||||
```{r}
|
||||
#| eval: false
|
||||
|
|
|
@ -33,7 +33,7 @@ Each chapter addresses one to a few aspects of creating a data visualization.
|
|||
|
||||
### Learning more
|
||||
|
||||
The absolute best place to learn more is the ggplot2 book: [*ggplot2: Elegant graphics for data analysis*](https://ggplot2-book.org/).
|
||||
The absolute best place to learn more is the ggplot2 book: [*ggplot2: Elegant graphics for data analysis (3e)*](https://ggplot2-book.org/).
|
||||
It goes into much more depth about the underlying theory, and has many more examples of how to combine the individual pieces to solve practical problems.
|
||||
|
||||
Another great resource is the ggplot2 extensions gallery <https://exts.ggplot2.tidyverse.org/gallery/>.
|
||||
|
|
|
@ -62,7 +62,7 @@ Code is miserable to read on a good day, so giveyoureyesabreak and use spaces.
|
|||
|
||||
## Comments
|
||||
|
||||
R will ignore any text after `#`.
|
||||
R will ignore any text after `#` for that line.
|
||||
This allows you to write **comments**, text that is ignored by R but read by other humans.
|
||||
We'll sometimes include comments in examples explaining what's happening with the code.
|
||||
|
||||
|
@ -133,7 +133,7 @@ Change 2.5 to 3.5 and rerun.
|
|||
Make yet another assignment:
|
||||
|
||||
```{r}
|
||||
r_rocks <- 2 ^ 3
|
||||
r_rocks <- 2^3
|
||||
```
|
||||
|
||||
Let's try to inspect it:
|
||||
|
|
Loading…
Reference in New Issue