The main data frame from the gapminder
package in three forms:
gap_simple
, same asgapminder::gapminder
gap_nested
, nested by country and continentgap_split
, split by country
Examples
gap_simple
#> # A tibble: 1,704 × 6
#> country continent year lifeExp pop gdpPercap
#> <fct> <fct> <int> <dbl> <int> <dbl>
#> 1 Afghanistan Asia 1952 28.8 8425333 779.
#> 2 Afghanistan Asia 1957 30.3 9240934 821.
#> 3 Afghanistan Asia 1962 32.0 10267083 853.
#> 4 Afghanistan Asia 1967 34.0 11537966 836.
#> 5 Afghanistan Asia 1972 36.1 13079460 740.
#> 6 Afghanistan Asia 1977 38.4 14880372 786.
#> 7 Afghanistan Asia 1982 39.9 12881816 978.
#> 8 Afghanistan Asia 1987 40.8 13867957 852.
#> 9 Afghanistan Asia 1992 41.7 16317921 649.
#> 10 Afghanistan Asia 1997 41.8 22227415 635.
#> # … with 1,694 more rows
gap_nested
#> # A tibble: 142 × 3
#> country continent data
#> <fct> <fct> <list>
#> 1 Afghanistan Asia <tibble [12 × 4]>
#> 2 Albania Europe <tibble [12 × 4]>
#> 3 Algeria Africa <tibble [12 × 4]>
#> 4 Angola Africa <tibble [12 × 4]>
#> 5 Argentina Americas <tibble [12 × 4]>
#> 6 Australia Oceania <tibble [12 × 4]>
#> 7 Austria Europe <tibble [12 × 4]>
#> 8 Bahrain Asia <tibble [12 × 4]>
#> 9 Bangladesh Asia <tibble [12 × 4]>
#> 10 Belgium Europe <tibble [12 × 4]>
#> # … with 132 more rows
str(gap_split, max.level = 1, list.len = 10)
#> List of 142
#> $ Afghanistan : tibble [12 × 6] (S3: tbl_df/tbl/data.frame)
#> $ Albania : tibble [12 × 6] (S3: tbl_df/tbl/data.frame)
#> $ Algeria : tibble [12 × 6] (S3: tbl_df/tbl/data.frame)
#> $ Angola : tibble [12 × 6] (S3: tbl_df/tbl/data.frame)
#> $ Argentina : tibble [12 × 6] (S3: tbl_df/tbl/data.frame)
#> $ Australia : tibble [12 × 6] (S3: tbl_df/tbl/data.frame)
#> $ Austria : tibble [12 × 6] (S3: tbl_df/tbl/data.frame)
#> $ Bahrain : tibble [12 × 6] (S3: tbl_df/tbl/data.frame)
#> $ Bangladesh : tibble [12 × 6] (S3: tbl_df/tbl/data.frame)
#> $ Belgium : tibble [12 × 6] (S3: tbl_df/tbl/data.frame)
#> [list output truncated]
str(gap_split[[1]])
#> tibble [12 × 6] (S3: tbl_df/tbl/data.frame)
#> $ country : Factor w/ 142 levels "Afghanistan",..: 1 1 1 1 1 1 1 1 1 1 ...
#> $ continent: Factor w/ 5 levels "Africa","Americas",..: 3 3 3 3 3 3 3 3 3 3 ...
#> $ year : int [1:12] 1952 1957 1962 1967 1972 1977 1982 1987 1992 1997 ...
#> $ lifeExp : num [1:12] 28.8 30.3 32 34 36.1 ...
#> $ pop : int [1:12] 8425333 9240934 10267083 11537966 13079460 14880372 12881816 13867957 16317921 22227415 ...
#> $ gdpPercap: num [1:12] 779 821 853 836 740 ...