Ejercicio 1

## Registered S3 method overwritten by 'GGally':
##   method from   
##   +.gg   ggplot2
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v tidyr   1.2.0     v dplyr   1.0.8
## v readr   2.1.2     v stringr 1.4.0
## v purrr   0.3.4     v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::between()   masks data.table::between()
## x dplyr::filter()    masks stats::filter()
## x dplyr::first()     masks data.table::first()
## x dplyr::lag()       masks stats::lag()
## x dplyr::last()      masks data.table::last()
## x purrr::map()       masks maps::map()
## x purrr::transpose() masks data.table::transpose()
## Rows: 9,845
## Columns: 38
## $ thomas_num     <dbl> 1, 2, 3, 4, 6, 8, 7, 9, 10, 11, 12, 14, 15, 16, 17, 18,~
## $ thomas_name    <chr> "Abdnor, James", "Abzug, Bella", "Adams, Brock", "Addab~
## $ icpsr          <int> 14000, 13001, 10700, 10500, 12000, 12001, 10501, 14001,~
## $ congress       <int> 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,~
## $ year           <int> 1973, 1973, 1973, 1973, 1973, 1973, 1973, 1973, 1973, 1~
## $ st_name        <chr> "SD", "NY", "WA", "NY", "AR", "CA", "IL", "NC", "ND", "~
## $ cd             <int> 2, 20, 7, 7, 1, 35, 16, 4, 1, 11, 7, 5, 17, 9, 1, 21, 1~
## $ dem            <int> 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1~
## $ elected        <int> 1972, 1970, 1964, 1960, 1968, 1968, 1960, 1972, 1963, 1~
## $ female         <int> 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0~
## $ votepct        <int> 55, 56, 85, 75, 100, 75, 72, 50, 73, 53, 82, 62, 57, 69~
## $ dwnom1         <dbl> 0.228, -0.687, -0.361, -0.400, -0.281, -0.293, 0.102, -~
## $ deleg_size     <int> 6, 39, 7, 39, 4, 43, 24, 11, 1, 24, 24, 5, 23, 23, 9, 3~
## $ speaker        <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0~
## $ subchr         <int> 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1~
## $ afam           <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0~
## $ latino         <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0~
## $ votepct_sq     <int> 3025, 3136, 7225, 5625, 10000, 5625, 5184, 2500, 5329, ~
## $ power          <int> 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0~
## $ chair          <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0~
## $ state_leg      <int> 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0~
## $ state_leg_prof <dbl> 0.104, 0.000, 0.000, 0.000, 0.000, 0.526, 0.000, 0.190,~
## $ majority       <int> 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1~
## $ maj_leader     <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0~
## $ min_leader     <int> 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0~
## $ meddist        <dbl> 0.275, 0.640, 0.314, 0.353, 0.234, 0.246, 0.149, 0.051,~
## $ majdist        <dbl> 0.547500014, 0.367499977, 0.041500002, 0.080500007, 0.0~
## $ all_bills      <int> 22, 136, 37, 38, 53, 87, 55, 17, 23, 53, 35, 11, 34, 28~
## $ all_aic        <int> 0, 1, 2, 0, 3, 0, 0, 0, 0, 2, 0, 1, 0, 5, 0, 0, 0, 2, 2~
## $ all_abc        <int> 0, 1, 2, 0, 3, 0, 0, 0, 0, 2, 0, 1, 0, 5, 0, 0, 0, 2, 2~
## $ all_pass       <int> 0, 1, 2, 0, 2, 0, 0, 0, 0, 2, 0, 1, 0, 5, 0, 0, 0, 1, 2~
## $ all_law        <int> 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 2, 0, 0, 0, 1, 1~
## $ les            <dbl> 0.10957027, 0.76243109, 1.23647845, 0.15505226, 1.87505~
## $ seniority      <int> 1, 2, 5, 7, 3, 3, 7, 1, 6, 5, 2, 1, 7, 10, 2, 2, 1, 2, ~
## $ benchmark      <dbl> 0.2713412, 0.5108124, 1.5303414, 1.5844928, 1.4761900, ~
## $ expectation    <int> 1, 2, 2, 1, 2, 2, 2, 1, 1, 1, 2, 2, 1, 3, 2, 1, 1, 3, 2~
## $ TotalInParty   <int> 197, 248, 248, 248, 248, 248, 197, 248, 197, 248, 197, ~
## $ RankInParty    <int> 132, 119, 88, 197, 64, 147, 67, 218, 135, 129, 103, 126~

Ejercicio 2

Ejercicio 3

Ejercicio 4

## Linking to GEOS 3.9.1, GDAL 3.2.1, PROJ 7.2.1; sf_use_s2() is TRUE
## 
## Attaching package: 'sf'
## The following object is masked from 'package:transformr':
## 
##     st_normalize
## Loading required package: sp
## rgeos version: 0.5-9, (SVN revision 684)
##  GEOS runtime version: 3.9.1-CAPI-1.14.2 
##  Please note that rgeos will be retired by the end of 2023,
## plan transition to sf functions using GEOS at your earliest convenience.
##  GEOS using OverlayNG
##  Linking to sp version: 1.4-6 
##  Polygon checking: TRUE

## Warning in region == c("Argentina", "Colombia", "Ecuador", "Peru", "Bolivia", :
## longitud de objeto mayor no es múltiplo de la longitud de uno menor

Ejercicio 5