Objetivo: Analizar Datos de Salarios utilizando

Cargamos las librerias

library(readr)
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
require(stats) #Para tener la misma semilla cuando la generemos

Cargamos los datos de Salarios

salarios <- read.csv("C:/Users/Gerencia Banthai/Documents/Ciencia de los datos/Datos/Salaries.csv",
                      encoding = "UTF-8")
# salarios Con esta linea de codigo checamos si nos trajimos los datos
#Verificamos los registros en Head para ver los primeros registros

head(salarios)
##   Id      EmployeeName                                       JobTitle
## 1  1    NATHANIEL FORD GENERAL MANAGER-METROPOLITAN TRANSIT AUTHORITY
## 2  2      GARY JIMENEZ                CAPTAIN III (POLICE DEPARTMENT)
## 3  3    ALBERT PARDINI                CAPTAIN III (POLICE DEPARTMENT)
## 4  4 CHRISTOPHER CHONG           WIRE ROPE CABLE MAINTENANCE MECHANIC
## 5  5   PATRICK GARDNER   DEPUTY CHIEF OF DEPARTMENT,(FIRE DEPARTMENT)
## 6  6    DAVID SULLIVAN                      ASSISTANT DEPUTY CHIEF II
##    BasePay OvertimePay OtherPay Benefits TotalPay TotalPayBenefits Year
## 1 167411.2        0.00 400184.2       NA 567595.4         567595.4 2011
## 2 155966.0   245131.88 137811.4       NA 538909.3         538909.3 2011
## 3 212739.1   106088.18  16452.6       NA 335279.9         335279.9 2011
## 4  77916.0    56120.71 198306.9       NA 332343.6         332343.6 2011
## 5 134401.6     9737.00 182234.6       NA 326373.2         326373.2 2011
## 6 118602.0     8601.00 189082.7       NA 316285.7         316285.7 2011
##   Notes        Agency Status
## 1    NA San Francisco       
## 2    NA San Francisco       
## 3    NA San Francisco       
## 4    NA San Francisco       
## 5    NA San Francisco       
## 6    NA San Francisco

Filtando el registro por nombre de empleado

filter(salarios,EmployeeName == "Kevin Lee")
##        Id EmployeeName                       JobTitle   BasePay
## 1   39716    Kevin Lee               Police Officer 3 115866.90
## 2   40571    Kevin Lee               Police Officer 3 117171.41
## 3   42511    Kevin Lee Electrical Transit System Mech  79220.54
## 4   49271    Kevin Lee         Deputy Court Clerk III  84512.32
## 5   49440    Kevin Lee         Deputy Court Clerk III  84512.34
## 6   50124    Kevin Lee              Personnel Analyst  83382.00
## 7   52234    Kevin Lee Senior Parking Control Officer  66774.03
## 8   53932    Kevin Lee               Transit Operator  57397.32
## 9   55120    Kevin Lee             IS Administrator 2  68940.44
## 10 112386    Kevin Lee                     Sergeant 3 137982.14
## 11 123142    Kevin Lee IT Operations Support Admin IV  91606.03
## 12 124166    Kevin Lee              Personnel Analyst  88353.01
## 13 124659    Kevin Lee               Transit Operator  67230.30
##    OvertimePay OtherPay Benefits  TotalPay TotalPayBenefits Year Notes
## 1     23523.30  9313.54 34906.20 148703.74        183609.94 2012    NA
## 2     19606.88  4244.90 34610.10 141023.19        175633.29 2012    NA
## 3     40247.39  3353.49 38781.04 122821.42        161602.46 2012    NA
## 4         0.00  1469.99 36080.30  85982.31        122062.61 2012    NA
## 5         0.00   975.44 35902.02  85487.78        121389.80 2012    NA
## 6         0.00     0.00 35210.59  83382.00        118592.59 2012    NA
## 7      9599.08  1092.62 31902.38  77465.73        109368.11 2012    NA
## 8      9989.83  1800.48 34577.54  69187.63        103765.17 2012    NA
## 9         0.00     0.00 30650.48  68940.44         99590.92 2012    NA
## 10    18537.19 16039.62 43039.12 172558.95        215598.07 2014    NA
## 11        0.00  1013.00 34109.61  92619.03        126728.64 2014    NA
## 12        0.00     0.00 33172.33  88353.01        121525.34 2014    NA
## 13    10961.25  4050.85 36777.83  82242.40        119020.23 2014    NA
##           Agency Status
## 1  San Francisco       
## 2  San Francisco       
## 3  San Francisco       
## 4  San Francisco       
## 5  San Francisco       
## 6  San Francisco       
## 7  San Francisco       
## 8  San Francisco       
## 9  San Francisco       
## 10 San Francisco     FT
## 11 San Francisco     FT
## 12 San Francisco     FT
## 13 San Francisco     FT

Filtramos cuantas personas ganan entre 150,000 y 170,000 en el año 2012

cuantas <- filter(salarios,TotalPayBenefits>=150000 & TotalPayBenefits <= 170000 & Year == 2012)
str(cuantas)
## 'data.frame':    2913 obs. of  13 variables:
##  $ Id              : int  41218 41219 41220 41221 41222 41223 41224 41225 41226 41227 ...
##  $ EmployeeName    : Factor w/ 110810 levels "A Bernard  Fatooh",..: 16010 20663 88354 60640 94542 73444 45099 108649 89546 64494 ...
##  $ JobTitle        : Factor w/ 2159 levels "Account Clerk",..: 1565 2087 234 806 615 1414 1413 1565 1415 625 ...
##  $ BasePay         : num  112611 102662 97609 110847 88374 ...
##  $ OvertimePay     : num  5648 19465 22952 3927 33428 ...
##  $ OtherPay        : num  6037 6254 8148 18492 10512 ...
##  $ Benefits        : num  45699 41608 41273 36714 37660 ...
##  $ TotalPay        : num  124296 128382 128709 133266 132314 ...
##  $ TotalPayBenefits: num  169995 169990 169982 169980 169973 ...
##  $ Year            : int  2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 ...
##  $ Notes           : logi  NA NA NA NA NA NA ...
##  $ Agency          : Factor w/ 1 level "San Francisco": 1 1 1 1 1 1 1 1 1 1 ...
##  $ Status          : Factor w/ 3 levels "","FT","PT": 1 1 1 1 1 1 1 1 1 1 ...
nrow(cuantas)
## [1] 2913

Filtramos cuantos registris estan arriba del Quartil al 75% conforma el salario totL

cuartil75 <- quantile(salarios$TotalPayBenefits,0.75)
cuantas <- filter(salarios,TotalPayBenefits>=cuartil75)
str(cuantas)
## 'data.frame':    37164 obs. of  13 variables:
##  $ Id              : int  1 2 3 4 5 6 7 8 9 10 ...
##  $ EmployeeName    : Factor w/ 110810 levels "A Bernard  Fatooh",..: 77636 34712 1560 17232 81101 23164 3271 22709 73975 47938 ...
##  $ JobTitle        : Factor w/ 2159 levels "Account Clerk",..: 836 298 298 2149 594 135 246 609 246 370 ...
##  $ BasePay         : num  167411 155966 212739 77916 134402 ...
##  $ OvertimePay     : num  0 245132 106088 56121 9737 ...
##  $ OtherPay        : num  400184 137811 16453 198307 182235 ...
##  $ Benefits        : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ TotalPay        : num  567595 538909 335280 332344 326373 ...
##  $ TotalPayBenefits: num  567595 538909 335280 332344 326373 ...
##  $ Year            : int  2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 ...
##  $ Notes           : logi  NA NA NA NA NA NA ...
##  $ Agency          : Factor w/ 1 level "San Francisco": 1 1 1 1 1 1 1 1 1 1 ...
##  $ Status          : Factor w/ 3 levels "","FT","PT": 1 1 1 1 1 1 1 1 1 1 ...
nrow(cuantas)
## [1] 37164

Filtramos usando selec para solo traer determinadas columnas

registros <- select(salarios, Id, EmployeeName, TotalPayBenefits, Year)
#registros Solo lo ponemos para checar que este haciendo lo que queremos 
cuales <- filter(registros,TotalPayBenefits>=150000 & TotalPayBenefits <= 170000 & Year == 2012)
head(cuales,20) #Mostramos los primeros 20 para ver si funciona
##       Id       EmployeeName TotalPayBenefits Year
## 1  41218    Cheryl De Lemos         169995.4 2012
## 2  41219     Daniel Godfrey         169990.1 2012
## 3  41220      Robert Harvey         169982.0 2012
## 4  41221 Lawrence McDonnell         169980.4 2012
## 5  41222      Sergio Chavez         169973.1 2012
## 6  41223     Michael Grande         169970.4 2012
## 7  41224       Jeffrey Chow         169963.2 2012
## 8  41225    Winilyn Hidalgo         169960.5 2012
## 9  41226         Rodney Lee         169960.3 2012
## 10 41227      Lucille Palma         169940.8 2012
## 11 41228      Jonathan Rapp         169939.2 2012
## 12 41229        Ajay Saxena         169936.3 2012
## 13 41230         Albert Tom         169933.8 2012
## 14 41231      Edith Hammond         169930.6 2012
## 15 41232         Hector Tam         169925.7 2012
## 16 41233        Eugene Ling         169898.1 2012
## 17 41234          Xing Wang         169897.1 2012
## 18 41235   Crystal McDonald         169893.1 2012
## 19 41236        Patrick Cox         169890.4 2012
## 20 41237   Balraj Singh Rai         169887.5 2012

Ordenar los datos con arrange

datosOrdenados <- arrange(cuales,EmployeeName)
head(datosOrdenados) # Checammos los primeros para ver si esta funcionando
##      Id    EmployeeName TotalPayBenefits Year
## 1 42773 Aaron Ballonado         159732.7 2012
## 2 41480    Aaron Cowhig         168330.4 2012
## 3 42067   Aaron Fischer         164280.9 2012
## 4 41965     Aaron Smith         164960.6 2012
## 5 42777       Aaron Yoo         159711.9 2012
## 6 42739  Abraham Abarca         159988.9 2012
tail(datosOrdenados) # Checammos los ultimos para ver si esta funcionando
##         Id              EmployeeName TotalPayBenefits Year
## 2908 41326 Yvonne Fuentes-Pattishall         169171.5 2012
## 2909 43221                Zahid Khan         156872.5 2012
## 2910 42623          Zara Grace Janer         160766.9 2012
## 2911 44083                 Zhong Qiu         150289.4 2012
## 2912 41647             Zoila Maguina         167054.6 2012
## 2913 42196                Zula Jones         163422.7 2012

Agregar columnas nuevas al conjunto de datos

Pueden ser al original o al que ya se tiene fitrado

Agregar un valor de 0 o 1 para genero

# Poner una semilla igual todos para generar la misma muestra
set.seed(1000) # Un valor de semilla
# Vamos a generar los generos 0 y 1 donde 0 es Masculino y 1 es Femenino
generos <- rep(0:1, 5000)   # Generamos un universo de 5000 valores entre 0 y 1
generos <- sample(generos, 2913) # Del universo que generamos tomamos una muestra de 2913 registros
generos
##    [1] 1 1 0 0 1 0 1 1 1 0 1 0 0 1 1 1 1 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0
##   [35] 1 1 1 0 1 0 0 1 1 0 0 1 1 0 1 1 1 1 1 0 0 1 0 0 1 0 0 0 0 0 1 0 0 0
##   [69] 1 0 0 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 1 0 1 0 0 0 1 1
##  [103] 0 0 1 1 0 0 0 1 1 0 0 1 0 0 0 0 1 1 0 0 0 1 1 1 1 1 0 1 0 0 1 0 0 1
##  [137] 1 1 0 0 0 1 1 0 1 0 1 0 0 0 0 1 0 0 0 1 0 1 0 1 1 1 0 0 0 1 1 1 1 0
##  [171] 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 1 0 1 0 0 1 1 0 1 0 0 0 0 0 0 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0 0 1 1 1 1 1 1 0 1 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 1 0 1 0 0 0
## [2585] 1 1 1 1 0 1 1 1 1 0 1 0 0 1 0 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 0 1 1 1
## [2619] 1 1 0 0 1 0 1 0 1 0 1 1 0 0 1 0 1 1 1 1 1 0 1 0 0 0 1 0 1 0 1 0 1 0
## [2653] 1 0 0 0 1 0 1 1 1 0 0 1 0 0 1 0 1 1 0 0 1 1 1 0 1 1 0 1 0 1 0 1 1 0
## [2687] 0 1 0 0 1 1 0 0 1 0 1 0 1 1 1 0 0 0 1 1 0 0 0 0 0 1 1 0 0 1 1 1 0 1
## [2721] 1 0 1 0 1 0 0 1 1 0 1 0 1 1 0 0 1 0 1 1 1 0 1 1 0 0 1 0 0 0 1 0 0 1
## [2755] 0 1 1 0 0 0 0 1 0 0 0 1 1 0 0 0 0 1 1 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0
## [2789] 1 1 0 0 1 1 1 1 1 0 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 1 0 1 1 0 0 1 1
## [2823] 0 0 0 1 1 1 1 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 0 0 0 0 0 1 1 0 0 0 0
## [2857] 0 1 1 0 0 0 0 1 0 1 1 1 0 0 1 0 1 1 0 1 0 1 0 1 1 1 1 1 0 0 1 0 1 0
## [2891] 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 0
cuales <- mutate(cuales, genero = generos) # Agrega columna genero a cuales
head(cuales, 100)# Mostramos los primeros 100 para revisar que esta bien
##        Id            EmployeeName TotalPayBenefits Year genero
## 1   41218         Cheryl De Lemos         169995.4 2012      1
## 2   41219          Daniel Godfrey         169990.1 2012      1
## 3   41220           Robert Harvey         169982.0 2012      0
## 4   41221      Lawrence McDonnell         169980.4 2012      0
## 5   41222           Sergio Chavez         169973.1 2012      1
## 6   41223          Michael Grande         169970.4 2012      0
## 7   41224            Jeffrey Chow         169963.2 2012      1
## 8   41225         Winilyn Hidalgo         169960.5 2012      1
## 9   41226              Rodney Lee         169960.3 2012      1
## 10  41227           Lucille Palma         169940.8 2012      0
## 11  41228           Jonathan Rapp         169939.2 2012      1
## 12  41229             Ajay Saxena         169936.3 2012      0
## 13  41230              Albert Tom         169933.8 2012      0
## 14  41231           Edith Hammond         169930.6 2012      1
## 15  41232              Hector Tam         169925.7 2012      1
## 16  41233             Eugene Ling         169898.1 2012      1
## 17  41234               Xing Wang         169897.1 2012      1
## 18  41235        Crystal McDonald         169893.1 2012      0
## 19  41236             Patrick Cox         169890.4 2012      1
## 20  41237        Balraj Singh Rai         169887.5 2012      1
## 21  41238     Jennifer Northridge         169879.5 2012      1
## 22  41239              Roger Fong         169876.2 2012      0
## 23  41240              Edgar Tabo         169876.1 2012      1
## 24  41241                 Kin Lee         169864.1 2012      0
## 25  41242            Kevin Adkins         169849.0 2012      1
## 26  41243         Curtis Caldwell         169837.2 2012      0
## 27  41244            Dianna Yanez         169831.5 2012      1
## 28  41245               Samuel Yu         169820.4 2012      1
## 29  41246              Eugene Shu         169811.9 2012      1
## 30  41247          Dale Winniford         169799.7 2012      1
## 31  41248       Clifford Burkhart         169798.2 2012      0
## 32  41249          Suzanne Miller         169794.0 2012      0
## 33  41250       Catheryn Williams         169791.3 2012      0
## 34  41251         Stephen Gritsch         169741.6 2012      0
## 35  41252    Maria Cecilia Martin         169740.3 2012      1
## 36  41253            Russell Roby         169736.7 2012      1
## 37  41254            Lawrence Soe         169732.1 2012      1
## 38  41255          Stephon Degand         169723.0 2012      0
## 39  41256           Michelle Tong         169704.5 2012      1
## 40  41257          James Kazarian         169704.2 2012      0
## 41  41258       Violeta Del Mundo         169699.7 2012      0
## 42  41259                Fred Lew         169693.3 2012      1
## 43  41260          Donald Bannett         169688.4 2012      1
## 44  41261             Miles Young         169673.6 2012      0
## 45  41262               Victor Le         169660.8 2012      0
## 46  41263              Eric Louie         169660.2 2012      1
## 47  41264             Lawrence Ng         169654.4 2012      1
## 48  41265            Eduard Ochoa         169639.7 2012      0
## 49  41266        Geoffrey Clayton         169635.6 2012      1
## 50  41267            Rona Sandler         169633.7 2012      1
## 51  41268              Larry Para         169624.0 2012      1
## 52  41269            Tracy Miesen         169619.6 2012      1
## 53  41270             Linda Moore         169607.8 2012      1
## 54  41271         Kaushal Bhaskar         169591.4 2012      0
## 55  41272          Moses Bautista         169562.9 2012      0
## 56  41273             Sophal Chea         169556.0 2012      1
## 57  41274     John Edward Herbert         169540.4 2012      0
## 58  41275           Shao Ping Lai         169540.4 2012      0
## 59  41276        William McCarthy         169527.5 2012      1
## 60  41277            Keith Baraka         169526.0 2012      0
## 61  41278           Richie Owyang         169518.8 2012      0
## 62  41279           Kenyon Bowers         169509.4 2012      0
## 63  41280         Herbert Mariano         169502.8 2012      0
## 64  41281             Maria Perez         169493.4 2012      0
## 65  41282             Gail Clabby         169492.0 2012      1
## 66  41283         Philip Secondez         169485.0 2012      0
## 67  41284         Marco Desangles         169480.8 2012      0
## 68  41285        Wilfredo Arquiza         169479.5 2012      0
## 69  41286             David Sands         169467.2 2012      1
## 70  41287          M J Castagnola         169463.2 2012      0
## 71  41288            Edwin Gaffud         169454.9 2012      0
## 72  41289           Sarah Lindley         169453.5 2012      1
## 73  41290         Carlos Manfredi         169442.4 2012      1
## 74  41291         Cathal Hennessy         169442.1 2012      1
## 75  41292        Diana Rosenstein         169432.1 2012      0
## 76  41293              Mary Russo         169431.2 2012      0
## 77  41294           Jeffrey Spano         169411.1 2012      0
## 78  41295              Craig Wong         169409.1 2012      1
## 79  41296          Fidel Gonzalez         169378.5 2012      1
## 80  41297        Deborah Heuerman         169373.7 2012      0
## 81  41298             Maria Lopez         169357.5 2012      0
## 82  41299           Diane Scarlet         169355.0 2012      0
## 83  41300 Cassandra Chapman-Tabor         169343.9 2012      0
## 84  41301       Gabriel Rodriguez         169331.7 2012      0
## 85  41302                Jeff Lai         169315.0 2012      0
## 86  41303         Thomas Macmahon         169308.8 2012      0
## 87  41304              Burton Wan         169307.1 2012      0
## 88  41305               Edwin Lee         169304.4 2012      0
## 89  41306             Kenneth Lim         169296.0 2012      0
## 90  41307            Thanh Nguyen         169295.9 2012      1
## 91  41308           Robert Boughn         169290.0 2012      1
## 92  41309            Joseph Boyle         169275.7 2012      0
## 93  41310        Antonio Balingit         169272.0 2012      1
## 94  41311         Garrett Edwards         169266.9 2012      1
## 95  41312            Shane Oneill         169255.5 2012      1
## 96  41313           Mary Callahan         169245.2 2012      0
## 97  41314            George Engel         169243.8 2012      1
## 98  41315            Barry Parker         169242.4 2012      0
## 99  41316          Jonathan Rider         169240.6 2012      0
## 100 41317          William Reilly         169239.7 2012      0

Agregar columna de estado civil y poner valores de 1 al 5 donde 1 Soltero 2 Casado 3 Feliz 4 divorsiado 5 Viudo

# Poner una semilla igual todos para generar la misma muestra
set.seed(1000) # Un valor de semilla
# Vamos a generar el estado civil y poner valores de 1 al 5 donde 1 Soltero 2 Casado 3 Feliz 4 divorsiado 5 Viudo

edociviles <- rep(1:5, 5000)   # Generamos un universo de 5000 valores entre 1 y 5
edociviles <- sample(edociviles, 2913) # Del universo que generamos tomamos una muestra de 2913 registros
edociviles
##    [1] 3 4 2 2 5 5 5 5 1 1 4 2 1 4 3 2 3 2 5 4 1 1 4 1 1 2 4 5 5 3 4 2 4 4
##   [35] 4 2 5 5 3 1 1 4 3 3 1 5 4 2 5 2 2 1 3 3 1 4 1 2 1 5 5 5 4 3 2 4 4 3
##   [69] 5 3 4 2 2 1 1 5 3 1 4 4 1 2 1 3 2 3 4 1 2 1 1 3 4 3 1 5 5 1 5 3 1 5
##  [103] 5 3 4 4 4 1 3 2 5 2 1 5 3 2 3 2 1 1 4 5 1 1 4 4 2 4 2 1 5 1 4 2 3 5
##  [137] 1 2 5 3 3 4 1 4 1 1 5 5 4 5 2 2 5 5 1 1 4 5 2 4 5 1 5 5 2 5 5 1 5 5
##  [171] 4 5 5 1 1 2 5 5 4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 3 3 2 4 4 3 4 5 1 1 3 4 2 2 2 2 5 2
## [2551] 3 5 4 3 2 5 1 1 4 1 1 3 2 2 4 4 4 2 1 3 4 5 2 4 3 2 5 4 1 1 3 4 5 1
## [2585] 2 5 5 1 2 1 1 4 3 3 3 3 3 3 1 1 2 4 4 1 4 2 4 1 3 3 1 1 3 3 2 2 4 5
## [2619] 1 3 1 1 3 1 5 4 5 5 4 1 3 4 4 5 3 4 1 2 2 5 1 2 2 1 1 2 3 1 3 5 3 4
## [2653] 5 2 4 5 5 3 4 5 1 1 2 4 3 1 2 4 4 3 2 4 5 5 1 4 4 4 1 4 2 5 1 4 3 1
## [2687] 2 3 5 3 4 5 4 3 2 3 5 4 4 1 5 3 2 4 4 2 4 4 2 1 2 5 1 5 4 2 2 5 4 1
## [2721] 2 2 2 5 3 4 1 5 2 2 2 2 2 3 5 1 4 3 2 5 5 1 5 4 3 3 4 4 2 5 5 5 3 4
## [2755] 3 2 2 2 4 3 5 4 3 4 4 1 2 2 3 1 2 4 2 3 3 1 2 2 3 1 1 1 5 1 1 4 4 2
## [2789] 1 3 2 4 3 2 2 1 1 4 3 3 3 2 4 1 5 1 3 2 4 4 3 2 3 1 3 3 2 4 3 4 3 2
## [2823] 1 5 1 4 3 5 4 3 2 3 3 5 2 1 2 2 3 1 4 3 4 4 3 5 3 4 5 4 1 3 2 1 2 3
## [2857] 3 3 3 1 4 4 3 2 5 2 3 4 3 3 4 4 3 4 1 3 4 4 5 2 4 3 5 2 3 3 3 2 4 5
## [2891] 2 2 5 2 2 4 2 4 5 5 5 4 4 4 1 1 1 5 4 1 3 5 1
cuales <- mutate(cuales, edocivil = edociviles) # Agrega columna edocivil a cuales

head(cuales, 100)  # Mostramos los primeros 100 para revisar que esta bien
##        Id            EmployeeName TotalPayBenefits Year genero edocivil
## 1   41218         Cheryl De Lemos         169995.4 2012      1        3
## 2   41219          Daniel Godfrey         169990.1 2012      1        4
## 3   41220           Robert Harvey         169982.0 2012      0        2
## 4   41221      Lawrence McDonnell         169980.4 2012      0        2
## 5   41222           Sergio Chavez         169973.1 2012      1        5
## 6   41223          Michael Grande         169970.4 2012      0        5
## 7   41224            Jeffrey Chow         169963.2 2012      1        5
## 8   41225         Winilyn Hidalgo         169960.5 2012      1        5
## 9   41226              Rodney Lee         169960.3 2012      1        1
## 10  41227           Lucille Palma         169940.8 2012      0        1
## 11  41228           Jonathan Rapp         169939.2 2012      1        4
## 12  41229             Ajay Saxena         169936.3 2012      0        2
## 13  41230              Albert Tom         169933.8 2012      0        1
## 14  41231           Edith Hammond         169930.6 2012      1        4
## 15  41232              Hector Tam         169925.7 2012      1        3
## 16  41233             Eugene Ling         169898.1 2012      1        2
## 17  41234               Xing Wang         169897.1 2012      1        3
## 18  41235        Crystal McDonald         169893.1 2012      0        2
## 19  41236             Patrick Cox         169890.4 2012      1        5
## 20  41237        Balraj Singh Rai         169887.5 2012      1        4
## 21  41238     Jennifer Northridge         169879.5 2012      1        1
## 22  41239              Roger Fong         169876.2 2012      0        1
## 23  41240              Edgar Tabo         169876.1 2012      1        4
## 24  41241                 Kin Lee         169864.1 2012      0        1
## 25  41242            Kevin Adkins         169849.0 2012      1        1
## 26  41243         Curtis Caldwell         169837.2 2012      0        2
## 27  41244            Dianna Yanez         169831.5 2012      1        4
## 28  41245               Samuel Yu         169820.4 2012      1        5
## 29  41246              Eugene Shu         169811.9 2012      1        5
## 30  41247          Dale Winniford         169799.7 2012      1        3
## 31  41248       Clifford Burkhart         169798.2 2012      0        4
## 32  41249          Suzanne Miller         169794.0 2012      0        2
## 33  41250       Catheryn Williams         169791.3 2012      0        4
## 34  41251         Stephen Gritsch         169741.6 2012      0        4
## 35  41252    Maria Cecilia Martin         169740.3 2012      1        4
## 36  41253            Russell Roby         169736.7 2012      1        2
## 37  41254            Lawrence Soe         169732.1 2012      1        5
## 38  41255          Stephon Degand         169723.0 2012      0        5
## 39  41256           Michelle Tong         169704.5 2012      1        3
## 40  41257          James Kazarian         169704.2 2012      0        1
## 41  41258       Violeta Del Mundo         169699.7 2012      0        1
## 42  41259                Fred Lew         169693.3 2012      1        4
## 43  41260          Donald Bannett         169688.4 2012      1        3
## 44  41261             Miles Young         169673.6 2012      0        3
## 45  41262               Victor Le         169660.8 2012      0        1
## 46  41263              Eric Louie         169660.2 2012      1        5
## 47  41264             Lawrence Ng         169654.4 2012      1        4
## 48  41265            Eduard Ochoa         169639.7 2012      0        2
## 49  41266        Geoffrey Clayton         169635.6 2012      1        5
## 50  41267            Rona Sandler         169633.7 2012      1        2
## 51  41268              Larry Para         169624.0 2012      1        2
## 52  41269            Tracy Miesen         169619.6 2012      1        1
## 53  41270             Linda Moore         169607.8 2012      1        3
## 54  41271         Kaushal Bhaskar         169591.4 2012      0        3
## 55  41272          Moses Bautista         169562.9 2012      0        1
## 56  41273             Sophal Chea         169556.0 2012      1        4
## 57  41274     John Edward Herbert         169540.4 2012      0        1
## 58  41275           Shao Ping Lai         169540.4 2012      0        2
## 59  41276        William McCarthy         169527.5 2012      1        1
## 60  41277            Keith Baraka         169526.0 2012      0        5
## 61  41278           Richie Owyang         169518.8 2012      0        5
## 62  41279           Kenyon Bowers         169509.4 2012      0        5
## 63  41280         Herbert Mariano         169502.8 2012      0        4
## 64  41281             Maria Perez         169493.4 2012      0        3
## 65  41282             Gail Clabby         169492.0 2012      1        2
## 66  41283         Philip Secondez         169485.0 2012      0        4
## 67  41284         Marco Desangles         169480.8 2012      0        4
## 68  41285        Wilfredo Arquiza         169479.5 2012      0        3
## 69  41286             David Sands         169467.2 2012      1        5
## 70  41287          M J Castagnola         169463.2 2012      0        3
## 71  41288            Edwin Gaffud         169454.9 2012      0        4
## 72  41289           Sarah Lindley         169453.5 2012      1        2
## 73  41290         Carlos Manfredi         169442.4 2012      1        2
## 74  41291         Cathal Hennessy         169442.1 2012      1        1
## 75  41292        Diana Rosenstein         169432.1 2012      0        1
## 76  41293              Mary Russo         169431.2 2012      0        5
## 77  41294           Jeffrey Spano         169411.1 2012      0        3
## 78  41295              Craig Wong         169409.1 2012      1        1
## 79  41296          Fidel Gonzalez         169378.5 2012      1        4
## 80  41297        Deborah Heuerman         169373.7 2012      0        4
## 81  41298             Maria Lopez         169357.5 2012      0        1
## 82  41299           Diane Scarlet         169355.0 2012      0        2
## 83  41300 Cassandra Chapman-Tabor         169343.9 2012      0        1
## 84  41301       Gabriel Rodriguez         169331.7 2012      0        3
## 85  41302                Jeff Lai         169315.0 2012      0        2
## 86  41303         Thomas Macmahon         169308.8 2012      0        3
## 87  41304              Burton Wan         169307.1 2012      0        4
## 88  41305               Edwin Lee         169304.4 2012      0        1
## 89  41306             Kenneth Lim         169296.0 2012      0        2
## 90  41307            Thanh Nguyen         169295.9 2012      1        1
## 91  41308           Robert Boughn         169290.0 2012      1        1
## 92  41309            Joseph Boyle         169275.7 2012      0        3
## 93  41310        Antonio Balingit         169272.0 2012      1        4
## 94  41311         Garrett Edwards         169266.9 2012      1        3
## 95  41312            Shane Oneill         169255.5 2012      1        1
## 96  41313           Mary Callahan         169245.2 2012      0        5
## 97  41314            George Engel         169243.8 2012      1        5
## 98  41315            Barry Parker         169242.4 2012      0        1
## 99  41316          Jonathan Rider         169240.6 2012      0        5
## 100 41317          William Reilly         169239.7 2012      0        3

Cuantos hay de genero 0 y de genero 1

# Genera una tabla cruzada o lo que es lo mismo la frecuencia de clases de algua variable en este caso es genero
table(cuales$genero)
## 
##    0    1 
## 1468 1445

Cuantos hay de cada Estado Civil

# Genera una tabla cruzada o lo que es lo mismo la frecuencia de clases de algua variable en este caso Estado civil
table(cuales$edocivil)
## 
##   1   2   3   4   5 
## 593 593 564 593 570

Vamos a ver un histograma

hist(cuales$genero)

hist(cuales$edocivil)

Interpretacion de la Practica

paste("En esta practica se filtro por nombre en este caso Kevin Lee del cual obtuvimos 13 registros, tambien filtramos las personas que reciben un sueldo entre 150,000 y 170,000 en el año 2012 de ahi obtuvimos 2913 registros, tambien filtramos las personas que estan por ensima del quartil al 75% que fueron 37164 registros, con la funcion selec solo nos trajimos algunas columnas para hacer mas entendibles los datos, ordenamos los datos con arrange y le agregamos 2 columnas a las cuales les asigamos variables aleatorias de genero y estado civil y por ultimo graficamos por genero y estado civil")
## [1] "En esta practica se filtro por nombre en este caso Kevin Lee del cual obtuvimos 13 registros, tambien filtramos las personas que reciben un sueldo entre 150,000 y 170,000 en el año 2012 de ahi obtuvimos 2913 registros, tambien filtramos las personas que estan por ensima del quartil al 75% que fueron 37164 registros, con la funcion selec solo nos trajimos algunas columnas para hacer mas entendibles los datos, ordenamos los datos con arrange y le agregamos 2 columnas a las cuales les asigamos variables aleatorias de genero y estado civil y por ultimo graficamos por genero y estado civil"