Parte 2 mujeres
library(htmltab)
linkm="https://en.wikipedia.org/wiki/List_of_Wimbledon_ladies%27_singles_champions"
linktabm="//div/table[4]"
mujer=htmltab(doc=linkm, which=linktabm)
names(mujer)
## [1] "Year" "Country" "Champion"
## [4] "Country" "Runner-up" "Score in the final"
mujer=mujer[c(2)]
names(mujer)
## [1] "Country"
str(mujer)
## 'data.frame': 52 obs. of 1 variable:
## $ Country: chr " USA" " GBR" " AUS" " AUS" ...
Viendo la data
mujer
## Country
## 2 USA
## 3 GBR
## 4 AUS
## 5 AUS
## 6 USA
## 7 USA
## 8 USA
## 9 USA
## 10 USA
## 11 GBR
## 12 USA
## 13 USA
## 14 AUS
## 15 USA
## 16 USA
## 17 USA
## 18 USA
## 19 USA
## 20 USA
## 21 USA
## 22 FRG
## 23 FRG
## 24 USA
## 25 GER
## 26 GER
## 27 GER
## 28 ESP
## 29 GER
## 30 GER
## 31 SUI
## 32 CZE
## 33 USA
## 34 USA
## 35 USA
## 36 USA
## 37 USA
## 38 RUS
## 39 USA
## 40 FRA
## 41 USA
## 42 USA
## 43 USA
## 44 USA
## 45 CZE
## 46 USA
## 47 FRA
## 48 CZE
## 49 USA
## 50 USA
## 51 ESP
## 52 GER
## 53 ROU
head(mujer)
## Country
## 2 USA
## 3 GBR
## 4 AUS
## 5 AUS
## 6 USA
## 7 USA
tabla de frecuencias
library(questionr)
library(magrittr)
Mu=freq(mujer$Country,total = F,sort = 'dec',exclude = c(NA)) %>% data.frame()
Mu=data.frame(variable=row.names(Mu),Mu,row.names = NULL)
Mu
## variable n X.
## 1 USA 29 55.8
## 2 GER 6 11.5
## 3 AUS 3 5.8
## 4 CZE 3 5.8
## 5 ESP 2 3.8
## 6 FRA 2 3.8
## 7 FRG 2 3.8
## 8 GBR 2 3.8
## 9 SUI 1 1.9
## 10 ROU 1 1.9
## 11 RUS 1 1.9
Graficos
library(ggplot2)
base= ggplot(data=Mu, aes(x=variable, y=n))
bar1=base+geom_bar(stat='identity')
bar1
Ordenando
bar1= bar1 + scale_x_discrete(limits=Mu$variable)
bar1
Títulos
text1="Open Era-Mujeres"
text2="País"
text3="Conteo"
text4="Fuente: Wikipedia"
bar2= bar1 + labs(title=text1,
x =text2,
y = text3,
caption = text4)
bar2
Pareto chart
library(qcc)
## Package 'qcc' version 2.7
## Type 'citation("qcc")' for citing this R package in publications.
pareto.chart(table(mujer$Country), cumperc = c(0,50, 80, 100))
##
## Pareto chart analysis for table(mujer$Country)
## Frequency Cum.Freq. Percentage Cum.Percent.
## USA 29.000000 29.000000 55.769231 55.769231
## GER 6.000000 35.000000 11.538462 67.307692
## AUS 3.000000 38.000000 5.769231 73.076923
## CZE 3.000000 41.000000 5.769231 78.846154
## ESP 2.000000 43.000000 3.846154 82.692308
## FRA 2.000000 45.000000 3.846154 86.538462
## FRG 2.000000 47.000000 3.846154 90.384615
## GBR 2.000000 49.000000 3.846154 94.230769
## SUI 1.000000 50.000000 1.923077 96.153846
## ROU 1.000000 51.000000 1.923077 98.076923
## RUS 1.000000 52.000000 1.923077 100.000000
El casi 80% de las ganadoras estan en USA, GER, AUS y CZE.
CALCULOS ESTADISTICOS
library(DescTools)
Mode(mujer$Country)
## [1] " USA"
Concentracion: Herfindahl- Hirschman
dataTable=table(mujer$Country)
Herfindahl(dataTable)
## [1] 0.3380178
Al ser mayor que 0.3 la moda se diferencia de los demás. Pais principal: Estados Unidos
Representatividad Efectiva : Laakso - Taagepera
1/sum(prop.table(dataTable)**2)
## [1] 2.958425
Tres grupos representativos.