Mention glimpse

This commit is contained in:
Hadley Wickham 2022-11-18 15:25:52 -06:00
parent df3d9cf513
commit 5d06b2c6d0
1 changed files with 8 additions and 3 deletions

View File

@ -47,10 +47,15 @@ flights
If you've used R before, you might notice that this data frame prints a little differently to other data frames you've seen.
That's because it's a **tibble**, a special type of data frame used by the tidyverse to avoid some common gotchas.
The most important difference is the way it prints: tibbles are designed for large datasets, so they only show the first few rows and only the columns that fit on one screen.
To see everything you can use `print(flights, width = Inf)` to show everything in the console, but it's generally more convenient to instead use `View(flights)` to open the dataset in the scrollable RStudio viewer.
There are a few options to see everything.
If you're using RStudio, the most convenient is probably `View(flights)`, which will open an interactive scrollable and filterable view.
Otherwise you can use `print(flights, width = Inf)` to show all columns, or use call `glimpse()`:
You might have noticed the short abbreviations that follow each column name.
These tell you the type of each variable: `<int>` is short for integer, `<dbl>` is short for double (aka real numbers), `<chr>` for character (aka strings), and `<dttm>` for date-time.
```{r}
glimpse(flights)
```
In both views, the variables names are followed by abbreviations that tell you the type of each variable: `<int>` is short for integer, `<dbl>` is short for double (aka real numbers), `<chr>` for character (aka strings), and `<dttm>` for date-time.
These are important because the operations you can perform on a column depend so much on its "type", and these types are used to organize the chapters in the next section of the book.
### dplyr basics