dplyr::glimpse()
get_help()
docs
The glimpse()
function is part of the {dplyr}
package, which is part of the {tidyverse}
.
We use this function to see a content overview of a tibble (data frame).
To use this function, you need to either first load the {dplyr}
library, or always use the function with dplyr::glimpse()
notation.
# Load the library
library(dplyr)
# Or, load the full tidyverse:
library(tidyverse)
# Or, use :: notation
::glimpse() dplyr
glimpse(tibble)
The examples below use the msleep
dataset. Learn more about this dataset with get_help("msleep")
.
# Show the msleep dataset with head()
head(msleep)
## # A tibble: 6 × 11
## name genus vore order conservation sleep_total sleep_rem sleep_cycle awake brainwt bodywt
## <chr> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Owl … Aotus omni Prim… <NA> 17 1.8 NA 7 0.0155 0.48
## 2 Moun… Aplo… herbi Rode… nt 14.4 2.4 NA 9.6 NA 1.35
## 3 Grea… Blar… omni Sori… lc 14.9 2.3 0.133 9.1 0.00029 0.019
## 4 Cow Bos herbi Arti… domesticated 4 0.7 0.667 20 0.423 600
## 5 Thre… Brad… herbi Pilo… <NA> 14.4 2.2 0.767 9.6 NA 3.85
## 6 Nort… Call… carni Carn… vu 8.7 1.4 0.383 15.3 NA 20.5
# Glimpse the msleep dataset
glimpse(msleep)
## Rows: 61
## Columns: 11
## $ name <chr> "Owl monkey", "Mountain beaver", "Greater short-tailed shrew", "Cow", "T…
## $ genus <chr> "Aotus", "Aplodontia", "Blarina", "Bos", "Bradypus", "Callorhinus", "Can…
## $ vore <chr> "omni", "herbi", "omni", "herbi", "herbi", "carni", "carni", "herbi", "h…
## $ order <chr> "Primates", "Rodentia", "Soricomorpha", "Artiodactyla", "Pilosa", "Carni…
## $ conservation <chr> NA, "nt", "lc", "domesticated", NA, "vu", "domesticated", "lc", "domesti…
## $ sleep_total <dbl> 17.0, 14.4, 14.9, 4.0, 14.4, 8.7, 10.1, 5.3, 9.4, 10.0, 12.5, 10.3, 8.3,…
## $ sleep_rem <dbl> 1.8, 2.4, 2.3, 0.7, 2.2, 1.4, 2.9, 0.6, 0.8, 0.7, 1.5, 2.2, 2.0, 1.4, 3.…
## $ sleep_cycle <dbl> NA, NA, 0.1333333, 0.6666667, 0.7666667, 0.3833333, 0.3333333, NA, 0.216…
## $ awake <dbl> 7.00, 9.60, 9.10, 20.00, 9.60, 15.30, 13.90, 18.70, 14.60, 14.00, 11.50,…
## $ brainwt <dbl> 0.01550, NA, 0.00029, 0.42300, NA, NA, 0.07000, 0.11500, 0.00550, NA, 0.…
## $ bodywt <dbl> 0.480, 1.350, 0.019, 600.000, 3.850, 20.490, 14.000, 33.500, 0.728, 4.75…