Debes responder las siguientes preguntas:

¿Cuántas universidades públicas y privadas existían en el país cuando se inició el proceso de licenciamiento institucional de universidades peruanas? ¿Cuántas universidades públicas obtuvieron el licenciamiento? ¿Cuántas universidades privadas obtuvieron el licenciamiento? ¿Cuáles son los 5 departamentos con mayor número de universidades licenciadas? Las respuestas deben ser redactadas en uno o varios párrafos de texto. No basta con generar las tablas o gráficos.

Cargar paquete

library(readxl)
licenciamiento_universidades <- read_xls("Licenciamiento Institucional_5.xls")
licenciamiento_universidades
## # A tibble: 143 x 10
##    CODIGO_ENTIDAD NOMBRE        TIPO_GESTION ESTADO_LICENCIAM… PERIODO_LICENCIA…
##    <chr>          <chr>         <chr>        <chr>                         <dbl>
##  1 091            UNIVERSIDAD … PRIVADO      LICENCIA DENEGADA                 0
##  2 016            UNIVERSIDAD … PÚBLICO      LICENCIA OTORGADA                 6
##  3 067            UNIVERSIDAD … PRIVADO      LICENCIA OTORGADA                 6
##  4 118            UNIVERSIDAD … PRIVADO      LICENCIA DENEGADA                 0
##  5 104            UNIVERSIDAD … PRIVADO      LICENCIA OTORGADA                 6
##  6 037            UNIVERSIDAD … PRIVADO      LICENCIA OTORGADA                 6
##  7 064            UNIVERSIDAD … PRIVADO      LICENCIA OTORGADA                 6
##  8 006            UNIVERSIDAD … PÚBLICO      LICENCIA OTORGADA                10
##  9 038            UNIVERSIDAD … PRIVADO      LICENCIA OTORGADA                 6
## 10 109            UNIVERSIDAD … PRIVADO      LICENCIA DENEGADA                 0
## # … with 133 more rows, and 5 more variables: DEPARTAMENTO_LOCAL <chr>,
## #   PROVINCIA_LOCAL <chr>, DISTRITO_LOCAL <chr>, LATITUD_UBICACION <dbl>,
## #   LONGITUD_UBICACION <dbl>

Pregunta 1

¿Cuántas universidades públicas y privadas existían en el país cuando se inició el proceso de licenciamiento institucional de universidades peruanas? 143 universidades

Cargar paquete

Siempre debo cargar el paquete, la instalación es solo una única vez.

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

Filter es para filas y select es para elegir columnas ## Pregunta 1

filter(licenciamiento_universidades, TIPO_GESTION == "PÚBLICO", ESTADO_LICENCIAMIENTO == "LICENCIA OTORGADA")
## # A tibble: 46 x 10
##    CODIGO_ENTIDAD NOMBRE         TIPO_GESTION ESTADO_LICENCIAM… PERIODO_LICENCI…
##    <chr>          <chr>          <chr>        <chr>                        <dbl>
##  1 016            UNIVERSIDAD N… PÚBLICO      LICENCIA OTORGADA                6
##  2 006            UNIVERSIDAD N… PÚBLICO      LICENCIA OTORGADA               10
##  3 005            UNIVERSIDAD N… PÚBLICO      LICENCIA OTORGADA               10
##  4 032            UNIVERSIDAD N… PÚBLICO      LICENCIA OTORGADA                6
##  5 075            UNIVERSIDAD N… PÚBLICO      LICENCIA OTORGADA                6
##  6 121            UNIVERSIDAD N… PÚBLICO      LICENCIA OTORGADA                6
##  7 077            UNIVERSIDAD N… PÚBLICO      LICENCIA OTORGADA                6
##  8 011            UNIVERSIDAD N… PÚBLICO      LICENCIA OTORGADA                8
##  9 025            UNIVERSIDAD N… PÚBLICO      LICENCIA OTORGADA                6
## 10 051            UNIVERSIDAD N… PÚBLICO      LICENCIA OTORGADA                6
## # … with 36 more rows, and 5 more variables: DEPARTAMENTO_LOCAL <chr>,
## #   PROVINCIA_LOCAL <chr>, DISTRITO_LOCAL <chr>, LATITUD_UBICACION <dbl>,
## #   LONGITUD_UBICACION <dbl>

¿Cuántas universidades públicas obtuvieron el licenciamiento? 46 universidades públicas cuentan con licencia otorgada

Pregunta 2

filter(licenciamiento_universidades, TIPO_GESTION == "PRIVADO", ESTADO_LICENCIAMIENTO == "LICENCIA OTORGADA")
## # A tibble: 46 x 10
##    CODIGO_ENTIDAD NOMBRE         TIPO_GESTION ESTADO_LICENCIA… PERIODO_LICENCIA…
##    <chr>          <chr>          <chr>        <chr>                        <dbl>
##  1 067            UNIVERSIDAD C… PRIVADO      LICENCIA OTORGA…                 6
##  2 104            UNIVERSIDAD L… PRIVADO      LICENCIA OTORGA…                 6
##  3 037            UNIVERSIDAD P… PRIVADO      LICENCIA OTORGA…                 6
##  4 064            UNIVERSIDAD P… PRIVADO      LICENCIA OTORGA…                 6
##  5 038            UNIVERSIDAD P… PRIVADO      LICENCIA OTORGA…                 6
##  6 018            UNIVERSIDAD D… PRIVADO      LICENCIA OTORGA…                 6
##  7 052            UNIVERSIDAD C… PRIVADO      LICENCIA OTORGA…                 6
##  8 014            UNIVERSIDAD P… PRIVADO      LICENCIA OTORGA…                10
##  9 074            UNIVERSIDAD C… PRIVADO      LICENCIA OTORGA…                 6
## 10 057            UNIVERSIDAD S… PRIVADO      LICENCIA OTORGA…                 6
## # … with 36 more rows, and 5 more variables: DEPARTAMENTO_LOCAL <chr>,
## #   PROVINCIA_LOCAL <chr>, DISTRITO_LOCAL <chr>, LATITUD_UBICACION <dbl>,
## #   LONGITUD_UBICACION <dbl>

¿Cuántas universidades privadas obtuvieron el licenciamiento? 46 universidades privadas cuentan con licencia otorgada

Pregunta 3

licenciamiento_universidades %>%
  filter(ESTADO_LICENCIAMIENTO == "LICENCIA OTORGADA")%>%
  group_by(DEPARTAMENTO_LOCAL) %>%
  summarise(n_licenciadas = n()) %>%
  ungroup() %>%
  arrange(desc(n_licenciadas))
## # A tibble: 25 x 2
##    DEPARTAMENTO_LOCAL n_licenciadas
##    <chr>                      <int>
##  1 LIMA                          36
##  2 JUNÍN                          6
##  3 LA LIBERTAD                    5
##  4 AREQUIPA                       4
##  5 APURÍMAC                       3
##  6 CAJAMARCA                      3
##  7 CUSCO                          3
##  8 HUANCAVELICA                   3
##  9 HUÁNUCO                        3
## 10 PIURA                          3
## # … with 15 more rows

¿Cuáles son los 5 departamentos con mayor número de universidades licenciadas? Lima (36), Junín (6), La Libertad (5), Arequipa (4) y Apurímac (3).

REPASO PIPES

Cargar paquetes

library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.3     ✓ purrr   0.3.4
## ✓ tibble  3.1.1     ✓ stringr 1.4.0
## ✓ tidyr   1.1.3     ✓ forcats 0.5.1
## ✓ readr   1.4.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(readxl)

Data

licenciamiento<- read_excel("Licenciamiento Institucional_5.xls")
licenciamiento
## # A tibble: 143 x 10
##    CODIGO_ENTIDAD NOMBRE        TIPO_GESTION ESTADO_LICENCIAM… PERIODO_LICENCIA…
##    <chr>          <chr>         <chr>        <chr>                         <dbl>
##  1 091            UNIVERSIDAD … PRIVADO      LICENCIA DENEGADA                 0
##  2 016            UNIVERSIDAD … PÚBLICO      LICENCIA OTORGADA                 6
##  3 067            UNIVERSIDAD … PRIVADO      LICENCIA OTORGADA                 6
##  4 118            UNIVERSIDAD … PRIVADO      LICENCIA DENEGADA                 0
##  5 104            UNIVERSIDAD … PRIVADO      LICENCIA OTORGADA                 6
##  6 037            UNIVERSIDAD … PRIVADO      LICENCIA OTORGADA                 6
##  7 064            UNIVERSIDAD … PRIVADO      LICENCIA OTORGADA                 6
##  8 006            UNIVERSIDAD … PÚBLICO      LICENCIA OTORGADA                10
##  9 038            UNIVERSIDAD … PRIVADO      LICENCIA OTORGADA                 6
## 10 109            UNIVERSIDAD … PRIVADO      LICENCIA DENEGADA                 0
## # … with 133 more rows, and 5 more variables: DEPARTAMENTO_LOCAL <chr>,
## #   PROVINCIA_LOCAL <chr>, DISTRITO_LOCAL <chr>, LATITUD_UBICACION <dbl>,
## #   LONGITUD_UBICACION <dbl>

Pregunta 3

licenciamiento %>%
  filter(ESTADO_LICENCIAMIENTO == "LICENCIA OTORGADA")%>%
  group_by(DEPARTAMENTO_LOCAL) %>%
  summarise(n_licenciadas = n()) %>%
  ungroup() %>%
  arrange(desc(n_licenciadas))
## # A tibble: 25 x 2
##    DEPARTAMENTO_LOCAL n_licenciadas
##    <chr>                      <int>
##  1 LIMA                          36
##  2 JUNÍN                          6
##  3 LA LIBERTAD                    5
##  4 AREQUIPA                       4
##  5 APURÍMAC                       3
##  6 CAJAMARCA                      3
##  7 CUSCO                          3
##  8 HUANCAVELICA                   3
##  9 HUÁNUCO                        3
## 10 PIURA                          3
## # … with 15 more rows

RESUMEN:

Debes responder las siguientes preguntas:

¿Cuántas universidades públicas y privadas existían en el país cuando se inició el proceso de licenciamiento institucional de universidades peruanas? 143 ¿Cuántas universidades públicas obtuvieron el licenciamiento? 46 ¿Cuántas universidades privadas obtuvieron el licenciamiento? 46 ¿Cuáles son los 5 departamentos con mayor número de universidades licenciadas? Lima (36), Junín (6), La Libertad (5), Arequipa (4) y Apurímac (3)

Repaso de pipes en conjunto

Cargar paquetes

library(tidyverse)
library(readxl)

Data

licenciamiento <- read_excel("Licenciamiento Institucional_5.xls")
  1. ¿Cuántas universidades públicas y privadas existían en el país cuando se inició el proceso de licenciamiento institucional de universidades peruanas?
licenciamiento %>% 
    summarise(n_de_univ = n())
## # A tibble: 1 x 1
##   n_de_univ
##       <int>
## 1       143

143 universidades

  1. ¿Cuántas universidades públicas obtuvieron el licenciamiento?
licenciamiento %>% 
    filter(TIPO_GESTION == "PÚBLICO", ESTADO_LICENCIAMIENTO == "LICENCIA OTORGADA") %>% 
    summarise(n_publicas_licenciadas = n())
## # A tibble: 1 x 1
##   n_publicas_licenciadas
##                    <int>
## 1                     46

46 universidades publicas licenciadas

  1. ¿Cuántas universidades privadas obtuvieron el licenciamiento?
 licenciamiento %>% 
    filter(TIPO_GESTION == "PRIVADO", ESTADO_LICENCIAMIENTO == "LICENCIA OTORGADA") %>% 
    summarise(n_privadas_licenciadas = n())
## # A tibble: 1 x 1
##   n_privadas_licenciadas
##                    <int>
## 1                     46

2 y 3:

licenciamiento %>% 
    filter(ESTADO_LICENCIAMIENTO == "LICENCIA OTORGADA") %>% 
    group_by(TIPO_GESTION) %>% 
    summarise(n_de_univ_licenciadas = n()) %>% 
    ungroup()
## # A tibble: 2 x 2
##   TIPO_GESTION n_de_univ_licenciadas
##   <chr>                        <int>
## 1 PRIVADO                         46
## 2 PÚBLICO                         46

1, 2 y 3:

licenciamiento %>% 
    summarise(
        n_univ_pre_licen = n(),
        n_publicas_licen = sum(TIPO_GESTION == "PÚBLICO" & ESTADO_LICENCIAMIENTO == "LICENCIA OTORGADA"),
        n_privadas_licen = sum(TIPO_GESTION == "PRIVADO" & ESTADO_LICENCIAMIENTO == "LICENCIA OTORGADA")
    )
## # A tibble: 1 x 3
##   n_univ_pre_licen n_publicas_licen n_privadas_licen
##              <int>            <int>            <int>
## 1              143               46               46
  1. ¿Cuáles son los 5 departamentos con mayor número de universidades licenciadas?
licenciamiento %>% 
    filter(ESTADO_LICENCIAMIENTO == "LICENCIA OTORGADA") %>% 
    group_by(DEPARTAMENTO_LOCAL) %>% 
    summarise(n_licenciadas = n()) %>% 
    ungroup() %>% 
    arrange(desc(n_licenciadas)) %>% 
    filter(n_licenciadas >= 3)
## # A tibble: 10 x 2
##    DEPARTAMENTO_LOCAL n_licenciadas
##    <chr>                      <int>
##  1 LIMA                          36
##  2 JUNÍN                          6
##  3 LA LIBERTAD                    5
##  4 AREQUIPA                       4
##  5 APURÍMAC                       3
##  6 CAJAMARCA                      3
##  7 CUSCO                          3
##  8 HUANCAVELICA                   3
##  9 HUÁNUCO                        3
## 10 PIURA                          3

Lima, Junín, La Libertad, Arequipa, Apurímac