Improve cross-references
* Fix broken links * Update chapter links
This commit is contained in:
@@ -11,7 +11,6 @@ status("polishing")
|
||||
|
||||
Working with data provided by R packages is a great way to learn the tools of data science, but at some point you want to stop learning and start working with your own data.
|
||||
In this chapter, you'll learn how to read plain-text rectangular files into R.
|
||||
Here, we'll only scratch the surface of data import, but many of the principles will translate to other forms of data, which we'll come back to in @sec-wrangle.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
@@ -116,7 +115,7 @@ There are two cases where you might want to tweak this behavior:
|
||||
read_csv("1,2,3\n4,5,6", col_names = FALSE)
|
||||
```
|
||||
|
||||
(`"\n"` is a convenient shortcut for adding a new line. You'll learn more about it and other types of string escape in [Chapter -@sec-strings].)
|
||||
(`"\n"` is a convenient shortcut for adding a new line. You'll learn more about it and other types of string escape in @sec-strings.)
|
||||
|
||||
Alternatively you can pass `col_names` a character vector which will be used as the column names:
|
||||
|
||||
@@ -171,7 +170,7 @@ Another common task after reading in data is to consider variable types.
|
||||
For example, `meal_type` is a categorical variable with a known set of possible values.
|
||||
In R, factors can be used to work with categorical variables.
|
||||
We can convert this variable to a factor using the `factor()` function.
|
||||
You'll learn more about factors in [Chapter -@sec-factors].
|
||||
You'll learn more about factors in @sec-factors.
|
||||
|
||||
```{r}
|
||||
students <- students |>
|
||||
@@ -184,7 +183,7 @@ students
|
||||
Note that the values in the `meal_type` variable has stayed exactly the same, but the type of variable denoted underneath the variable name has changed from character (`<chr>`) to factor (`<fct>`).
|
||||
|
||||
Before you move on to analyzing these data, you'll probably want to fix the `age` column as well: currently it's a character variable because of the one observation that is typed out as `five` instead of a numeric `5`.
|
||||
We discuss the details of fixing this issue in [Chapter -@sec-import-spreadsheets] in further detail.
|
||||
We discuss the details of fixing this issue in @sec-import-spreadsheets in further detail.
|
||||
|
||||
### Compared to base R
|
||||
|
||||
@@ -331,7 +330,7 @@ file.remove("students.rds")
|
||||
|
||||
In this chapter, you've learned how to use readr to load rectangular flat files from disk into R.
|
||||
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-databases will show you how to load data from databases, @sec-import-spreadsheets from Excel and googlesheets, @sec-import-rectangling from JSON, and @sec-import-scraping from websites.
|
||||
We'll come to data import a few times in this book: @sec-import-databases will show you how to load data from databases, @sec-import-spreadsheets from Excel and googlesheets, @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.
|
||||
|
||||
Reference in New Issue
Block a user