Navigating
tomes uses Vim’s keys, and counts work too (5j, 50%).
Scrolling
| Key | What |
|---|---|
j k |
Down, up a line (the cursor line moves; the page follows) |
Ctrl-e Ctrl-y |
Scroll the page a line |
Ctrl-d Ctrl-u |
Half a screen |
Ctrl-f Ctrl-b |
A screen |
gg G |
Top, bottom |
H M L |
Cursor to the top, middle, bottom of the screen |
zz zt zb |
Scroll so the cursor line is in the middle, top, bottom |
{ } |
Previous, next paragraph |
[[ ]] |
Previous, next section |
[c ]c |
Previous, next code block |
[f ]f |
Previous, next figure or table |
< > |
Previous, next chapter |
The outline
The outline lists the chapters, and the sections of the chapter you’re reading; the one you’re in is marked with ▸. Chapters you’ve read get a ✓. Space e shows or hides it, and Ctrl-w h moves into it: then j, k, and Enter pick a section, and Esc goes back to the text. In a narrow terminal the outline opens on top of the text.
tomes https://r4ds.hadley.nz/ -c 'Data transformation'
R for Data Science (2e) │ ┃
Welcome │ 3 Data transformation │
Preface to the second edition │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │
Introduction │ │
Whole game │ 3.1 Introduction │
1 Data visualization │ ──────────────── │
2 Workflow: basics │ │
▸3 Data transformation │ Visualization is an important tool for generating insight, but it’s rare │
3.1 Introduction │ that you get the data in exactly the right form you need to make the │
3.1.1 Prerequisites │ graph you want. Often you’ll need to create some new variables or │
3.1.2 nycflights13 │ summaries to answer your questions with your data, or maybe you just │
3.1.3 dplyr basics │ want to rename the variables or reorder the observations to make the │
3.2 Rows │ data a little easier to work with. You’ll learn how to do all that (and │
3.2.1 filter() │ more!) in this chapter, which will introduce you to data transformation │
3.2.2 Common mistakes │ using the dplyr package and a new dataset on flights that departed from │
3.2.3 arrange() │ New York City in 2013. │
3.2.4 distinct() │ │
3.2.5 Exercises │ The goal of this chapter is to give you an overview of all the key tools │
3.3 Columns │ for transforming a data frame. We’ll start with functions that operate │
3.3.1 mutate() │ on rows and then columns of a data frame, then circle back to talk more │
3.3.2 select() │ about the pipe, an important tool that you use to combine verbs. We will │
3.3.3 rename() │ then introduce the ability to work with groups. We will end the chapter │
3.3.4 relocate() │ with a case study that showcases these functions in action. In later │
3.3.5 Exercises │ chapters, we’ll return to the functions in more detail as we start to │
3.4 The pipe │ dig into specific types of data (e.g., numbers, strings, dates). │
3.5 Groups │ │
3.5.1 group_by() │ 3.1.1 Prerequisites │
3.5.2 summarize() │ │
3.5.3 The slice_ functions │ In this chapter, we’ll focus on the dplyr package, another core member │
Welcome! Press ? for the keys, Space e for the outline, Ctrl-p to search ▶ terminal term 7/38 Top
R for Data Science (2e) │ ┃
Welcome │ 3 Data transformation │
Preface to the second edition │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │
Introduction │ │
Whole game │ 3.1 Introduction │
1 Data visualization │ ──────────────── │
2 Workflow: basics │ │
▸3 Data transformation │ Visualization is an important tool for generating insight, but it’s rare │
3.1 Introduction │ that you get the data in exactly the right form you need to make the │
3.1.1 Prerequisites │ graph you want. Often you’ll need to create some new variables or │
3.1.2 nycflights13 │ summaries to answer your questions with your data, or maybe you just │
3.1.3 dplyr basics │ want to rename the variables or reorder the observations to make the │
3.2 Rows │ data a little easier to work with. You’ll learn how to do all that (and │
3.2.1 filter() │ more!) in this chapter, which will introduce you to data transformation │
3.2.2 Common mistakes │ using the dplyr package and a new dataset on flights that departed from │
3.2.3 arrange() │ New York City in 2013. │
3.2.4 distinct() │ │
3.2.5 Exercises │ The goal of this chapter is to give you an overview of all the key tools │
3.3 Columns │ for transforming a data frame. We’ll start with functions that operate │
3.3.1 mutate() │ on rows and then columns of a data frame, then circle back to talk more │
3.3.2 select() │ about the pipe, an important tool that you use to combine verbs. We will │
3.3.3 rename() │ then introduce the ability to work with groups. We will end the chapter │
3.3.4 relocate() │ with a case study that showcases these functions in action. In later │
3.3.5 Exercises │ chapters, we’ll return to the functions in more detail as we start to │
3.4 The pipe │ dig into specific types of data (e.g., numbers, strings, dates). │
3.5 Groups │ │
3.5.1 group_by() │ 3.1.1 Prerequisites │
3.5.2 summarize() │ │
3.5.3 The slice_ functions │ In this chapter, we’ll focus on the dplyr package, another core member │
3 Data transformation ▶ terminal term 7/38 Top
Folding
za folds the section the cursor is in (or a callout, or long output), zM folds every section, and zR unfolds everything:
R for Data Science (2e) │
Welcome │ 3 Data transformation
Preface to the second edition │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Introduction │
Whole game │ ▸ 3.1 Introduction …
1 Data visualization │
2 Workflow: basics │ ▸ 3.2 Rows …
▸3 Data transformation │
3.1 Introduction ▸ │ ▸ 3.3 Columns …
3.2 Rows ▸ │
3.3 Columns ▸ │ ▸ 3.4 The pipe …
3.4 The pipe ▸ │
3.5 Groups ▸ │ ▸ 3.5 Groups …
3.6 Case study: aggregates … │
3.7 Summary ▸ │ ▸ 3.6 Case study: aggregates and sample size …
4 Workflow: code style │
5 Data tidying │ ▸ 3.7 Summary …
6 Workflow: scripts and proj… │
7 Data import │ ────────────────────
8 Workflow: getting help │ Footnotes
Visualize │
9 Layers │ 1. Later, you’ll learn about the slice_*() family, which allows you to
10 Exploratory data analysis │ choose rows based on their positions.
11 Communication │ 2. Remember that in RStudio, the easiest way to see a dataset with many
Transform │ columns is View().
12 Logical vectors │ 3. Or summarise(), if you prefer British English.
13 Numbers │ 4. *cough* the law of large numbers *cough*.
14 Strings │
15 Regular expressions │
3 Data transformation ▶ terminal term 7/38 All
Long output of terminal sessions is folded from the start, with a line that says how much is hidden; za on it (or a click) shows it.
Going back
Following a link, searching, and jumping to a section remember where you were. Ctrl-o (or Backspace) goes back, Ctrl-i forward again.
Marks work as in Vim: ma sets mark a, 'a goes back to it, and '' to where you were before. B bookmarks the place (with the section and the line), and Space b lists your bookmarks, in every chapter.
The mouse
Everything works with the keyboard, but the mouse works too: scroll with the wheel, click links, sections in the outline, headings (to fold), figures, and the ⧉ copy and ▶ send buttons. Drag to select lines and copy them. Space m turns the mouse off, so your terminal selects text as usual (with the mouse on, hold Shift).