# On the command line

Besides the reader, tomes has commands that print. `-b` (`--book`) says which book; without it, tomes uses the book you read last.


# The outline


tomes


``` term-output
tomes -b https://r4ds.hadley.nz/ toc | head -20
     Welcome
     Preface to the second edition
     Introduction
       What you will learn
       How this book is organized
       What you won't learn
       Prerequisites
       Running R code
       Acknowledgments
       Colophon
     Whole game
  1  Data visualization
       1.1 Introduction
       1.2 First steps
       1.3 ggplot2 calls
       1.4 Visualizing distributions
       1.5 Visualizing relationships
       1.6 Saving your plots
       1.7 Common problems
       1.8 Summary
```


# A chapter

`cat` prints a chapter with colors when the output is a terminal (or with `--color always`), so `less -R` shows it as in the reader:


tomes


``` term-output
tomes -b https://r4ds.hadley.nz/ cat "data transformation" --color never --width 80 | head -24

3  Data transformation
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

3.1 Introduction
────────────────

Visualization is an important tool for generating insight, but it's rare that
you get the data in exactly the right form you need to make the graph you want.
Often you'll need to create some new variables or summaries to answer your
questions with your data, or maybe you just want to rename the variables or
reorder the observations to make the data a little easier to work with. You'll
learn how to do all that (and more!) in this chapter, which will introduce you
to data transformation using the dplyr package and a new dataset on flights that
departed from New York City in 2013.

The goal of this chapter is to give you an overview of all the key tools for
transforming a data frame. We'll start with functions that operate on rows and
then columns of a data frame, then circle back to talk more about the pipe, an
important tool that you use to combine verbs. We will then introduce the ability
to work with groups. We will end the chapter with a case study that showcases
these functions in action. In later chapters, we'll return to the functions in
more detail as we start to dig into specific types of data (e.g., numbers,
strings, dates).
```


Chapters are found by number, by file name, or by part of their title.


# Searching


tomes


``` term-output
tomes -b https://r4ds.hadley.nz/ search "left join" -n 3
21  Databases › 21.5.8 Joins
  $ #> LEFT JOIN planes
19  Joins › 19.4 How do joins work?
  ! Figure 19.5: A visual representation of the left join where every row in x appears in the output.
19  Joins › 19.4 How do joins work?
  ! …the previous diagram showing an left join, the x table now gains a virtual row so that every row i…
```


# Every command of a chapter

`commands` prints the code of a chapter, grouped by section, as a script you can read along with:


tomes


``` term-output
tomes -b https://dsatcl.jeroenjanssens.com/ commands 5 | head -15
# 5  Scrubbing Data

# 5.1 Overview
cd /data/ch05
l

# 5.2 Transformations, Transformations Everywhere
seq 100 |
/data/ch04/fizzbuzz.py |
tee fb.seq | trim
grep -E "fizz|buzz" fb.seq |
sort | uniq -c | sort -nr > fb.cnt
bat -A fb.cnt
< fb.cnt awk 'BEGIN { print "value,count" } { print $2","$1 }' > fb.csv
bat fb.csv
```


See the [reference](../reference/cli/index.md) for every option.
