library(readr)
read_csv("data/gapminder_comas.csv")
##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## country = col_character(),
## continent = col_character(),
## year = col_double(),
## lifeExp = col_double(),
## pop = col_double(),
## gdpPercap = col_double()
## )
## # A tibble: 1,704 x 6
## country continent year lifeExp pop gdpPercap
## <chr> <chr> <dbl> <dbl> <dbl> <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
datos_obtenidos_csv <- read_csv("data/gapminder_comas.csv")
##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## country = col_character(),
## continent = col_character(),
## year = col_double(),
## lifeExp = col_double(),
## pop = col_double(),
## gdpPercap = col_double()
## )
datos_obtenidos_csv
## # A tibble: 1,704 x 6
## country continent year lifeExp pop gdpPercap
## <chr> <chr> <dbl> <dbl> <dbl> <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
datos_obtenidos_tsv <- read_tsv("data/gapminder_tabs.tsv")
##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## country = col_character(),
## continent = col_character(),
## year = col_double(),
## lifeExp = col_double(),
## pop = col_double(),
## gdpPercap = col_double()
## )
datos_obtenidos_tsv
## # A tibble: 1,704 x 6
## country continent year lifeExp pop gdpPercap
## <chr> <chr> <dbl> <dbl> <dbl> <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
datos_obtenidos_michi <- read_delim("data/gapminder_michi.txt", delim = "#")
##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## country = col_character(),
## continent = col_character(),
## year = col_double(),
## lifeExp = col_double(),
## pop = col_double(),
## gdpPercap = col_double()
## )
datos_obtenidos_michi
## # A tibble: 1,704 x 6
## country continent year lifeExp pop gdpPercap
## <chr> <chr> <dbl> <dbl> <dbl> <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
datos_obtenidos_punto_y_coma <- read_delim("data/gapminder_comas2.txt", delim = ";")
##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## country = col_character(),
## continent = col_character(),
## year = col_double(),
## lifeExp = col_double(),
## pop = col_double(),
## gdpPercap = col_double()
## )
datos_obtenidos_punto_y_coma
datos_obtenidos_slash<- read_delim("data/gapminder_slash.txt", delim = "/")
##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## country = col_character(),
## continent = col_character(),
## year = col_double(),
## lifeExp = col_double(),
## pop = col_double(),
## gdpPercap = col_double()
## )
datos_obtenidos_slash
datos_obtenidos_guiones<- read_delim("data/gapminder_guiones.txt", delim = "_")
##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## `country-continent-year-lifeExp-pop-gdpPercap` = col_character()
## )
## Warning: 24 parsing failures.
## row col expected actual file
## 625 country-continent-year-lifeExp-pop-gdpPercap delimiter or quote - 'data/gapminder_guiones.txt'
## 625 country-continent-year-lifeExp-pop-gdpPercap delimiter or quote G 'data/gapminder_guiones.txt'
## 625 country-continent-year-lifeExp-pop-gdpPercap delimiter or quote - 'data/gapminder_guiones.txt'
## 625 country-continent-year-lifeExp-pop-gdpPercap delimiter or quote G 'data/gapminder_guiones.txt'
## 625 country-continent-year-lifeExp-pop-gdpPercap delimiter or quote - 'data/gapminder_guiones.txt'
## ... ............................................ .................. ...... ............................
## See problems(...) for more details.
datos_obtenidos_guiones
library(readxl)
Leer “gapminder_excel.xlsx”
gapminder_excel <- read_xlsx("data/gapminder_excel.xlsx")
gapminder_excel
## # A tibble: 1,704 x 6
## country continent year lifeExp pop gdpPercap
## <chr> <chr> <dbl> <dbl> <dbl> <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
Manera alternativa
gapminder_excel2 <- read_excel("data/gapminder_excel.xlsx")
gapminder_excel2
library(haven)
Leer “09_UNIVERSIDADES_CARATULA.SAV”
read_sav ("data/09_UNIVERSIDADES_CARATULA.SAV")
## # A tibble: 122 x 8
## SELECT UC0DD_CD UC0DD_DPTO UC0PP_CD UC0PP_PROV UC0DI_CD UC0DI_DIST UC0P_OBS
## <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 U0001 16 LORETO 01 MAYNAS 13 SAN JUAN BA… ""
## 2 U0002 14 LAMBAYEQUE 03 LAMBAYEQUE 01 LAMBAYEQUE ""
## 3 U0003 15 LIMA 01 LIMA 40 SANTIAGO DE… ""
## 4 U0004 15 LIMA 01 LIMA 13 JESUS MARIA ""
## 5 U0005 15 LIMA 01 LIMA 35 SAN MARTIN … ""
## 6 U0006 15 LIMA 01 LIMA 40 SANTIAGO DE… ""
## 7 U0007 15 LIMA 01 LIMA 21 PUEBLO LIBRE ""
## 8 U0008 23 TACNA 01 TACNA 01 TACNA ""
## 9 U0009 10 HUANUCO 01 HUANUCO 01 HUANUCO ""
## 10 U0010 15 LIMA 01 LIMA 13 JESUS MARIA ""
## # … with 112 more rows
datos_spss <- read_sav("data/09_UNIVERSIDADES_CARATULA.SAV")
datos_spss
## # A tibble: 122 x 8
## SELECT UC0DD_CD UC0DD_DPTO UC0PP_CD UC0PP_PROV UC0DI_CD UC0DI_DIST UC0P_OBS
## <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 U0001 16 LORETO 01 MAYNAS 13 SAN JUAN BA… ""
## 2 U0002 14 LAMBAYEQUE 03 LAMBAYEQUE 01 LAMBAYEQUE ""
## 3 U0003 15 LIMA 01 LIMA 40 SANTIAGO DE… ""
## 4 U0004 15 LIMA 01 LIMA 13 JESUS MARIA ""
## 5 U0005 15 LIMA 01 LIMA 35 SAN MARTIN … ""
## 6 U0006 15 LIMA 01 LIMA 40 SANTIAGO DE… ""
## 7 U0007 15 LIMA 01 LIMA 21 PUEBLO LIBRE ""
## 8 U0008 23 TACNA 01 TACNA 01 TACNA ""
## 9 U0009 10 HUANUCO 01 HUANUCO 01 HUANUCO ""
## 10 U0010 15 LIMA 01 LIMA 13 JESUS MARIA ""
## # … with 112 more rows
Manera alternativa de leer spss con read_spss()
datos_spss2 <- read_spss("data/09_UNIVERSIDADES_CARATULA.SAV")
datos_spss2
## # A tibble: 122 x 8
## SELECT UC0DD_CD UC0DD_DPTO UC0PP_CD UC0PP_PROV UC0DI_CD UC0DI_DIST UC0P_OBS
## <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 U0001 16 LORETO 01 MAYNAS 13 SAN JUAN BA… ""
## 2 U0002 14 LAMBAYEQUE 03 LAMBAYEQUE 01 LAMBAYEQUE ""
## 3 U0003 15 LIMA 01 LIMA 40 SANTIAGO DE… ""
## 4 U0004 15 LIMA 01 LIMA 13 JESUS MARIA ""
## 5 U0005 15 LIMA 01 LIMA 35 SAN MARTIN … ""
## 6 U0006 15 LIMA 01 LIMA 40 SANTIAGO DE… ""
## 7 U0007 15 LIMA 01 LIMA 21 PUEBLO LIBRE ""
## 8 U0008 23 TACNA 01 TACNA 01 TACNA ""
## 9 U0009 10 HUANUCO 01 HUANUCO 01 HUANUCO ""
## 10 U0010 15 LIMA 01 LIMA 13 JESUS MARIA ""
## # … with 112 more rows
gap_excel_skip <- read_xlsx("data/gapminder_excel_skip.xlsx", skip = 3)
library(readxl)
read_xlsx("data/gapminder_excel_sheet.xlsx",sheet = 2)
## # A tibble: 1,704 x 6
## country continent year lifeExp pop gdpPercap
## <chr> <chr> <dbl> <dbl> <dbl> <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_excel_sheet1<- read_xlsx("data/gapminder_excel_sheet.xlsx",sheet = "Hoja 2")
gap_excel_sheet2<- read_xlsx("data/gapminder_excel_sheet.xlsx",sheet = 2)
read_xlsx("data/gapminder_excel_col_names.xlsx")
## # A tibble: 1,703 x 6
## Afghanistan Asia `1952` `28.800999999999998` `8425333` `779.44531449999999`
## <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 Afghanistan Asia 1957 30.3 9240934 821.
## 2 Afghanistan Asia 1962 32.0 10267083 853.
## 3 Afghanistan Asia 1967 34.0 11537966 836.
## 4 Afghanistan Asia 1972 36.1 13079460 740.
## 5 Afghanistan Asia 1977 38.4 14880372 786.
## 6 Afghanistan Asia 1982 39.9 12881816 978.
## 7 Afghanistan Asia 1987 40.8 13867957 852.
## 8 Afghanistan Asia 1992 41.7 16317921 649.
## 9 Afghanistan Asia 1997 41.8 22227415 635.
## 10 Afghanistan Asia 2002 42.1 25268405 727.
## # … with 1,693 more rows
gap_excel_col_names <- read_xlsx("data/gapminder_excel_col_names.xlsx",col_names=FALSE)
## New names:
## * `` -> ...1
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * ...
read_xlsx("data/gapminder_excel_sheet.xlsx", 2)
## # A tibble: 1,704 x 6
## country continent year lifeExp pop gdpPercap
## <chr> <chr> <dbl> <dbl> <dbl> <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_excel_col_names <- read_xlsx("data/gapminder_excel_col_names.xlsx",col_names=FALSE)
## New names:
## * `` -> ...1
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * ...
library(vcdExtra)
## Loading required package: vcd
## Loading required package: grid
## Loading required package: gnm
library(datasets)
datasets("ggplot2")
## Loading package: ggplot2
## Item class dim
## 1 diamonds data.frame 53940x10
## 2 economics data.frame 574x6
## 3 economics_long data.frame 2870x4
## 4 faithfuld data.frame 5625x3
## 5 luv_colours data.frame 657x4
## 6 midwest data.frame 437x28
## 7 mpg data.frame 234x11
## 8 msleep data.frame 83x11
## 9 presidential data.frame 11x4
## 10 seals data.frame 1155x4
## 11 txhousing data.frame 8602x9
## Title
## 1 Prices of over 50,000 round cut diamonds
## 2 US economic time series
## 3 US economic time series
## 4 2d density estimate of Old Faithful data
## 5 'colors()' in Luv space
## 6 Midwest demographics
## 7 Fuel economy data from 1999 to 2008 for 38 popular models of cars
## 8 An updated and expanded version of the mammals sleep dataset
## 9 Terms of 11 presidents from Eisenhower to Obama
## 10 Vector field of seal movements
## 11 Housing sales in TX