library(readr)
library(knitr)
df <- read.csv("https://raw.githubusercontent.com/lihkir/AnalisisEstadisticoUN/main/Data/catalog.csv")
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
colnames(df)[5] <- "Country"
colnames(df)[7] <- "State"
colnames(df)[9] <- "City"
colnames(df)[10] <- "Distance"
library(readr)
library(knitr)
df_cr <- subset (df, Country == "Costa Rica")
knitr::kable(head(df_cr))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 38 | 249 | 9/9/07 | NA | Costa Rica | CR | Heredia | 21947 | Heredia | 0.26208 | 10.0000 | -84.1167 | (10, -84.116699999999994) | Landslide | Landslide | Medium | Rain | NA | NA | ticotimes.net | http://www.ticotimes.net/dailyarchive/2007_09/0911072.htm | |||
| 44 | 299 | 10/9/07 | NA | Costa Rica | CR | San José | 3072 | San Ignacio | 4.57763 | 9.7789 | -84.1250 | (9.7789000000000001, -84.125) | Landslide | Complex | Medium | Rain | NA | 4 | ticotimes.net | http://www.ticotimes.net/dailyarchive/2007_10/1010071.htm | |||
| 45 | 301 | 10/11/07 | NA | Costa Rica | CR | Alajuela | 7014 | Atenas | 3.08459 | 9.9869 | -84.4070 | (9.9869000000000003, -84.406999999999996) | Landslide | Mudslide | Large | Rain | NA | 14 | Agence France-Presse, afp.google.com | http://afp.google.com/article/ALeqM5hu6a8oyAM1ycq9nU_6Zyj_l7F0AA | |||
| 46 | 302 | 10/11/07 | NA | Costa Rica | CR | San José | 26669 | 9.56251 | 10.0214 | -83.9451 | (10.0214, -83.945099999999996) | Landslide | Landslide | Large | Rain | NA | 10 | International Herald | http://www.iht.com/articles/ap/2007/10/12/america/LA-GEN-Costa-Rica-Mudslide.php | ||||
| 51 | 323 | 10/24/07 | NA | Costa Rica | CR | Puntarenas | 6540 | Miramar | 3.82425 | Mine construction | 10.0715 | -84.7575 | (10.0715, -84.757499999999993) | Landslide | Mudslide | Medium | Downpour | NA | NA | Reuters - AlertNet.org | http://www.reuters.com/article/companyNewsAndPR/idUSN2435152820071025 | ||
| 102 | 556 | 5/29/08 | NA | Costa Rica | CR | Guanacaste | 4108 | Bagaces | 17.65521 | 10.4024 | -85.3555 | (10.4024, -85.355500000000006) | Landslide | Landslide | Medium | Tropical cyclone | Tropical Storm Alma | NA | NA | http://www.reliefweb.int/rw/RWB.NSF/db900SID/ASAZ-7FHCHL?OpenDocument |
df_cr %>%
select(Country, State, City, Distance)
## Country State City Distance
## 38 Costa Rica Heredia Heredia 0.26208
## 44 Costa Rica San José San Ignacio 4.57763
## 45 Costa Rica Alajuela Atenas 3.08459
## 46 Costa Rica San José 9.56251
## 51 Costa Rica Puntarenas Miramar 3.82425
## 102 Costa Rica Guanacaste Bagaces 17.65521
## 147 Costa Rica San José Daniel Flores 1.85787
## 153 Costa Rica San José San Isidro 16.24937
## 154 Costa Rica San José Santiago 12.85801
## 156 Costa Rica Puntarenas Golfito 11.74074
## 157 Costa Rica Puntarenas Miramar 8.92048
## 229 Costa Rica Puntarenas San Vito 18.00524
## 302 Costa Rica Alajuela Desamparados 6.88715
## 311 Costa Rica Heredia Ángeles 19.51432
## 347 Costa Rica Alajuela Desamparados 6.92174
## 395 Costa Rica Alajuela Desamparados 4.24199
## 459 Costa Rica Alajuela San Rafael 1.47396
## 469 Costa Rica San José Salitral 0.25254
## 470 Costa Rica San José Salitral 0.25254
## 480 Costa Rica Heredia Ángeles 14.81614
## 501 Costa Rica San José Escazú 3.67691
## 502 Costa Rica San José San Marcos 0.55804
## 503 Costa Rica Alajuela San Rafael 9.61692
## 504 Costa Rica Guanacaste Tilarán 10.21631
## 505 Costa Rica Cartago Orosí 19.28722
## 506 Costa Rica Puntarenas Golfito 7.87044
## 507 Costa Rica San José Tejar 6.49523
## 508 Costa Rica San José San Isidro 15.64997
## 509 Costa Rica Puntarenas Corredor 4.93053
## 510 Costa Rica Puntarenas Parrita 13.48919
## 511 Costa Rica Puntarenas Ciudad Cortés 20.06633
## 512 Costa Rica San José San Isidro 11.31047
## 513 Costa Rica San José Mercedes 8.21372
## 514 Costa Rica Alajuela Santiago 5.43516
## 529 Costa Rica Heredia Ángeles 19.54581
## 579 Costa Rica Limón Guápiles 17.23264
## 702 Costa Rica Heredia Ángeles 15.05161
## 780 Costa Rica Alajuela Upala 0.70048
## 819 Costa Rica San José San Isidro 21.67452
## 828 Costa Rica Cartago Cot 9.63616
## 884 Costa Rica Heredia Santo Domingo 21.95470
## 888 Costa Rica Guanacaste Tilarán 12.33807
## 889 Costa Rica Limón Siquirres 5.36500
## 913 Costa Rica San José Daniel Flores 4.89954
## 1098 Costa Rica Alajuela Sabanilla 4.87432
## 1156 Costa Rica Alajuela Sabanilla 10.32968
## 1157 Costa Rica Heredia Santo Domingo 9.85736
## 1169 Costa Rica Guanacaste Tilarán 12.21952
## 1173 Costa Rica Guanacaste Tilarán 12.18115
## 1289 Costa Rica Alajuela La Fortuna 9.84213
## 1301 Costa Rica Alajuela 5.57523
## 1308 Costa Rica Alajuela Desamparados 5.95519
## 1342 Costa Rica Alajuela Rio Segundo 11.96524
## 1364 Costa Rica Alajuela Desamparados 5.12667
## 1383 Costa Rica Cartago Cartago 3.07297
## 1384 Costa Rica Heredia Dulce Nombre de Jesus 10.01310
## 1385 Costa Rica San José Dulce Nombre de Jesus 2.92605
## 1386 Costa Rica San José San Isidro 10.73752
## 1404 Costa Rica San José San Isidro 22.32368
## 1406 Costa Rica San José Dulce Nombre de Jesus 8.39161
## 1461 Costa Rica Alajuela La Fortuna 5.96634
## 1475 Costa Rica Alajuela Atenas 6.80061
## 1528 Costa Rica San José Ángeles 9.53611
## 1529 Costa Rica San José Dulce Nombre de Jesus 3.71407
## 1600 Costa Rica San José San Juan 0.72957
## 1642 Costa Rica Alajuela Santo Domingo 3.21979
## 1643 Costa Rica Alajuela Alajuela 3.08916
## 1644 Costa Rica Alajuela Naranjo 2.08469
## 1646 Costa Rica Cartago 5.15142
## 1647 Costa Rica Cartago Cot 9.53493
## 1648 Costa Rica Cartago Cartago 2.94804
## 1649 Costa Rica Puntarenas Buenos Aires 0.35225
## 1650 Costa Rica San José San José 1.16705
## 1651 Costa Rica San José Mercedes 10.01198
## 1652 Costa Rica San José Santiago 8.27042
library(ggplot2)
ggplot(data=df_cr, aes(x= State , y= Distance)) + geom_bar(stat="identity", color="black", fill="purple")
library(ggplot2)
library(dplyr)
ggplot(data=df_cr, aes(fill=City, x="Costa Rica", y=Distance)) +
geom_bar(position="dodge", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_cr, aes(fill=City, x="Costa Rica", y=Distance)) +
geom_bar(position="stack", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_cr, aes(x = "Costa Rica", y = Distance , fill=City)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y", start = 0)
library(qcc)
## Package 'qcc' version 2.7
## Type 'citation("qcc")' for citing this R package in publications.
Distance <- df_cr$Distance
names(Distance) <- df_cr$City
pareto.chart(Distance,
ylab="Distance",
col = heat.colors(length(Distance)),
cumperc = seq(0, 100, by = 10),
ylab2 = "Porcentaje acumulado",
main = "DONDE SE CONCENTRAN LAS CIUDADES CON MAYORES DESLIZAMIENTOS")
##
## Pareto chart analysis for Distance
## Frequency Cum.Freq. Percentage Cum.Percent.
## San Isidro 22.32368000 22.32368000 3.45492296 3.45492296
## Santo Domingo 21.95470000 44.27838000 3.39781780 6.85274076
## San Isidro 21.67452000 65.95290000 3.35445576 10.20719651
## Ciudad Cortés 20.06633000 86.01923000 3.10556433 13.31276084
## Ángeles 19.54581000 105.56504000 3.02500608 16.33776693
## Ángeles 19.51432000 125.07936000 3.02013254 19.35789946
## Orosí 19.28722000 144.36658000 2.98498542 22.34288488
## San Vito 18.00524000 162.37182000 2.78657986 25.12946474
## Bagaces 17.65521000 180.02703000 2.73240749 27.86187223
## Guápiles 17.23264000 197.25967000 2.66700847 30.52888070
## San Isidro 16.24937000 213.50904000 2.51483275 33.04371345
## San Isidro 15.64997000 229.15901000 2.42206664 35.46578009
## Ángeles 15.05161000 244.21062000 2.32946150 37.79524159
## Ángeles 14.81614000 259.02676000 2.29301900 40.08826059
## Parrita 13.48919000 272.51595000 2.08765366 42.17591425
## Santiago 12.85801000 285.37396000 1.98996913 44.16588338
## Tilarán 12.33807000 297.71203000 1.90950065 46.07538402
## Tilarán 12.21952000 309.93155000 1.89115326 47.96653728
## Tilarán 12.18115000 322.11270000 1.88521493 49.85175221
## Rio Segundo 11.96524000 334.07794000 1.85179963 51.70355185
## Golfito 11.74074000 345.81868000 1.81705490 53.52060675
## San Isidro 11.31047000 357.12915000 1.75046419 55.27107094
## San Isidro 10.73752000 367.86667000 1.66179162 56.93286257
## Sabanilla 10.32968000 378.19635000 1.59867229 58.53153486
## Tilarán 10.21631000 388.41266000 1.58112659 60.11266145
## Dulce Nombre de Jesus 10.01310000 398.42576000 1.54967681 61.66233825
## Mercedes 10.01198000 408.43774000 1.54950347 63.21184172
## Santo Domingo 9.85736000 418.29510000 1.52557371 64.73741544
## La Fortuna 9.84213000 428.13723000 1.52321664 66.26063208
## Cot 9.63616000 437.77339000 1.49133971 67.75197179
## San Rafael 9.61692000 447.39031000 1.48836203 69.24033382
## 9.56251000 456.95282000 1.47994127 70.72027510
## Ángeles 9.53611000 466.48893000 1.47585548 72.19613057
## Cot 9.53493000 476.02386000 1.47567286 73.67180343
## Miramar 8.92048000 484.94434000 1.38057754 75.05238097
## Dulce Nombre de Jesus 8.39161000 493.33595000 1.29872701 76.35110797
## Santiago 8.27042000 501.60637000 1.27997104 77.63107902
## Mercedes 8.21372000 509.82009000 1.27119587 78.90227489
## Golfito 7.87044000 517.69053000 1.21806816 80.12034305
## Desamparados 6.92174000 524.61227000 1.07124267 81.19158572
## Desamparados 6.88715000 531.49942000 1.06588935 82.25747506
## Atenas 6.80061000 538.30003000 1.05249599 83.30997105
## Tejar 6.49523000 544.79526000 1.00523387 84.31520492
## La Fortuna 5.96634000 550.76160000 0.92338024 85.23858516
## Desamparados 5.95519000 556.71679000 0.92165461 86.16023978
## 5.57523000 562.29202000 0.86285013 87.02308991
## Santiago 5.43516000 567.72718000 0.84117220 87.86426211
## Siquirres 5.36500000 573.09218000 0.83031390 88.69457601
## 5.15142000 578.24360000 0.79725920 89.49183521
## Desamparados 5.12667000 583.37027000 0.79342877 90.28526397
## Corredor 4.93053000 588.30080000 0.76307317 91.04833715
## Daniel Flores 4.89954000 593.20034000 0.75827701 91.80661415
## Sabanilla 4.87432000 598.07466000 0.75437384 92.56098799
## San Ignacio 4.57763000 602.65229000 0.70845663 93.26944461
## Desamparados 4.24199000 606.89428000 0.65651132 93.92595593
## Miramar 3.82425000 610.71853000 0.59185982 94.51781575
## Dulce Nombre de Jesus 3.71407000 614.43260000 0.57480782 95.09262357
## Escazú 3.67691000 618.10951000 0.56905675 95.66168032
## Santo Domingo 3.21979000 621.32930000 0.49831060 96.15999092
## Alajuela 3.08916000 624.41846000 0.47809366 96.63808457
## Atenas 3.08459000 627.50305000 0.47738638 97.11547096
## Cartago 3.07297000 630.57602000 0.47558801 97.59105897
## Cartago 2.94804000 633.52406000 0.45625323 98.04731220
## Dulce Nombre de Jesus 2.92605000 636.45011000 0.45284995 98.50016215
## Naranjo 2.08469000 638.53480000 0.32263692 98.82279907
## Daniel Flores 1.85787000 640.39267000 0.28753314 99.11033220
## San Rafael 1.47396000 641.86663000 0.22811733 99.33844953
## San José 1.16705000 643.03368000 0.18061842 99.51906795
## San Juan 0.72957000 643.76325000 0.11291186 99.63197981
## Upala 0.70048000 644.46373000 0.10840974 99.74038955
## San Marcos 0.55804000 645.02177000 0.08636503 99.82675458
## Buenos Aires 0.35225000 645.37402000 0.05451595 99.88127053
## Heredia 0.26208000 645.63610000 0.04056080 99.92183132
## Salitral 0.25254000 645.88864000 0.03908434 99.96091566
## Salitral 0.25254000 646.14118000 0.03908434 100.00000000
stem(df_cr$"Distance")
##
## The decimal point is at the |
##
## 0 | 3334677259
## 2 | 1991112778
## 4 | 2699912446
## 6 | 0058999
## 8 | 23495566689
## 10 | 0023737
## 12 | 022395
## 14 | 816
## 16 | 227
## 18 | 0355
## 20 | 17
## 22 | 03
head(df_cr)
## id date time continent_code Country country_code State
## 38 249 9/9/07 <NA> Costa Rica CR Heredia
## 44 299 10/9/07 <NA> Costa Rica CR San José
## 45 301 10/11/07 <NA> Costa Rica CR Alajuela
## 46 302 10/11/07 <NA> Costa Rica CR San José
## 51 323 10/24/07 <NA> Costa Rica CR Puntarenas
## 102 556 5/29/08 <NA> Costa Rica CR Guanacaste
## population City Distance location_description latitude longitude
## 38 21947 Heredia 0.26208 10.0000 -84.1167
## 44 3072 San Ignacio 4.57763 9.7789 -84.1250
## 45 7014 Atenas 3.08459 9.9869 -84.4070
## 46 26669 9.56251 10.0214 -83.9451
## 51 6540 Miramar 3.82425 Mine construction 10.0715 -84.7575
## 102 4108 Bagaces 17.65521 10.4024 -85.3555
## geolocation hazard_type landslide_type
## 38 (10, -84.116699999999994) Landslide Landslide
## 44 (9.7789000000000001, -84.125) Landslide Complex
## 45 (9.9869000000000003, -84.406999999999996) Landslide Mudslide
## 46 (10.0214, -83.945099999999996) Landslide Landslide
## 51 (10.0715, -84.757499999999993) Landslide Mudslide
## 102 (10.4024, -85.355500000000006) Landslide Landslide
## landslide_size trigger storm_name injuries fatalities
## 38 Medium Rain NA NA
## 44 Medium Rain NA 4
## 45 Large Rain NA 14
## 46 Large Rain NA 10
## 51 Medium Downpour NA NA
## 102 Medium Tropical cyclone Tropical Storm Alma NA NA
## source_name
## 38 ticotimes.net
## 44 ticotimes.net
## 45 Agence France-Presse, afp.google.com
## 46 International Herald
## 51 Reuters - AlertNet.org
## 102
## source_link
## 38 http://www.ticotimes.net/dailyarchive/2007_09/0911072.htm
## 44 http://www.ticotimes.net/dailyarchive/2007_10/1010071.htm
## 45 http://afp.google.com/article/ALeqM5hu6a8oyAM1ycq9nU_6Zyj_l7F0AA
## 46 http://www.iht.com/articles/ap/2007/10/12/america/LA-GEN-Costa-Rica-Mudslide.php
## 51 http://www.reuters.com/article/companyNewsAndPR/idUSN2435152820071025
## 102 http://www.reliefweb.int/rw/RWB.NSF/db900SID/ASAZ-7FHCHL?OpenDocument
knitr::kable(head(df_cr))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 38 | 249 | 9/9/07 | NA | Costa Rica | CR | Heredia | 21947 | Heredia | 0.26208 | 10.0000 | -84.1167 | (10, -84.116699999999994) | Landslide | Landslide | Medium | Rain | NA | NA | ticotimes.net | http://www.ticotimes.net/dailyarchive/2007_09/0911072.htm | |||
| 44 | 299 | 10/9/07 | NA | Costa Rica | CR | San José | 3072 | San Ignacio | 4.57763 | 9.7789 | -84.1250 | (9.7789000000000001, -84.125) | Landslide | Complex | Medium | Rain | NA | 4 | ticotimes.net | http://www.ticotimes.net/dailyarchive/2007_10/1010071.htm | |||
| 45 | 301 | 10/11/07 | NA | Costa Rica | CR | Alajuela | 7014 | Atenas | 3.08459 | 9.9869 | -84.4070 | (9.9869000000000003, -84.406999999999996) | Landslide | Mudslide | Large | Rain | NA | 14 | Agence France-Presse, afp.google.com | http://afp.google.com/article/ALeqM5hu6a8oyAM1ycq9nU_6Zyj_l7F0AA | |||
| 46 | 302 | 10/11/07 | NA | Costa Rica | CR | San José | 26669 | 9.56251 | 10.0214 | -83.9451 | (10.0214, -83.945099999999996) | Landslide | Landslide | Large | Rain | NA | 10 | International Herald | http://www.iht.com/articles/ap/2007/10/12/america/LA-GEN-Costa-Rica-Mudslide.php | ||||
| 51 | 323 | 10/24/07 | NA | Costa Rica | CR | Puntarenas | 6540 | Miramar | 3.82425 | Mine construction | 10.0715 | -84.7575 | (10.0715, -84.757499999999993) | Landslide | Mudslide | Medium | Downpour | NA | NA | Reuters - AlertNet.org | http://www.reuters.com/article/companyNewsAndPR/idUSN2435152820071025 | ||
| 102 | 556 | 5/29/08 | NA | Costa Rica | CR | Guanacaste | 4108 | Bagaces | 17.65521 | 10.4024 | -85.3555 | (10.4024, -85.355500000000006) | Landslide | Landslide | Medium | Tropical cyclone | Tropical Storm Alma | NA | NA | http://www.reliefweb.int/rw/RWB.NSF/db900SID/ASAZ-7FHCHL?OpenDocument |
stem(df_cr$"Distance")
##
## The decimal point is at the |
##
## 0 | 3334677259
## 2 | 1991112778
## 4 | 2699912446
## 6 | 0058999
## 8 | 23495566689
## 10 | 0023737
## 12 | 022395
## 14 | 816
## 16 | 227
## 18 | 0355
## 20 | 17
## 22 | 03
stem(df_cr$"Distance", scale = 2)
##
## The decimal point is at the |
##
## 0 | 3334677259
## 2 | 1991112778
## 4 | 2699912446
## 6 | 0058999
## 8 | 23495566689
## 10 | 0023737
## 12 | 022395
## 14 | 816
## 16 | 227
## 18 | 0355
## 20 | 17
## 22 | 03
library(forecast)
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
data<- ts(df_cr$Distance, frequency=12, start=2008)
knitr::kable(head(data))
| x |
|---|
| 0.26208 |
| 4.57763 |
| 3.08459 |
| 9.56251 |
| 3.82425 |
| 17.65521 |
autoplot(data) + labs(title = "Gráfico de series temporales", x="date", y = "distancia", colour = "green") +theme_bw()
library(questionr)
table <- questionr::freq(Distance, cum = TRUE, sort = "dec", total = TRUE)
knitr::kable(table)
| n | % | val% | %cum | val%cum | |
|---|---|---|---|---|---|
| 0.25254 | 2 | 2.7 | 2.7 | 2.7 | 2.7 |
| 0.26208 | 1 | 1.3 | 1.3 | 4.0 | 4.0 |
| 0.35225 | 1 | 1.3 | 1.3 | 5.3 | 5.3 |
| 0.55804 | 1 | 1.3 | 1.3 | 6.7 | 6.7 |
| 0.70048 | 1 | 1.3 | 1.3 | 8.0 | 8.0 |
| 0.72957 | 1 | 1.3 | 1.3 | 9.3 | 9.3 |
| 1.16705 | 1 | 1.3 | 1.3 | 10.7 | 10.7 |
| 1.47396 | 1 | 1.3 | 1.3 | 12.0 | 12.0 |
| 1.85787 | 1 | 1.3 | 1.3 | 13.3 | 13.3 |
| 2.08469 | 1 | 1.3 | 1.3 | 14.7 | 14.7 |
| 2.92605 | 1 | 1.3 | 1.3 | 16.0 | 16.0 |
| 2.94804 | 1 | 1.3 | 1.3 | 17.3 | 17.3 |
| 3.07297 | 1 | 1.3 | 1.3 | 18.7 | 18.7 |
| 3.08459 | 1 | 1.3 | 1.3 | 20.0 | 20.0 |
| 3.08916 | 1 | 1.3 | 1.3 | 21.3 | 21.3 |
| 3.21979 | 1 | 1.3 | 1.3 | 22.7 | 22.7 |
| 3.67691 | 1 | 1.3 | 1.3 | 24.0 | 24.0 |
| 3.71407 | 1 | 1.3 | 1.3 | 25.3 | 25.3 |
| 3.82425 | 1 | 1.3 | 1.3 | 26.7 | 26.7 |
| 4.24199 | 1 | 1.3 | 1.3 | 28.0 | 28.0 |
| 4.57763 | 1 | 1.3 | 1.3 | 29.3 | 29.3 |
| 4.87432 | 1 | 1.3 | 1.3 | 30.7 | 30.7 |
| 4.89954 | 1 | 1.3 | 1.3 | 32.0 | 32.0 |
| 4.93053 | 1 | 1.3 | 1.3 | 33.3 | 33.3 |
| 5.12667 | 1 | 1.3 | 1.3 | 34.7 | 34.7 |
| 5.15142 | 1 | 1.3 | 1.3 | 36.0 | 36.0 |
| 5.365 | 1 | 1.3 | 1.3 | 37.3 | 37.3 |
| 5.43516 | 1 | 1.3 | 1.3 | 38.7 | 38.7 |
| 5.57523 | 1 | 1.3 | 1.3 | 40.0 | 40.0 |
| 5.95519 | 1 | 1.3 | 1.3 | 41.3 | 41.3 |
| 5.96634 | 1 | 1.3 | 1.3 | 42.7 | 42.7 |
| 6.49523 | 1 | 1.3 | 1.3 | 44.0 | 44.0 |
| 6.80061 | 1 | 1.3 | 1.3 | 45.3 | 45.3 |
| 6.88715 | 1 | 1.3 | 1.3 | 46.7 | 46.7 |
| 6.92174 | 1 | 1.3 | 1.3 | 48.0 | 48.0 |
| 7.87044 | 1 | 1.3 | 1.3 | 49.3 | 49.3 |
| 8.21372 | 1 | 1.3 | 1.3 | 50.7 | 50.7 |
| 8.27042 | 1 | 1.3 | 1.3 | 52.0 | 52.0 |
| 8.39161 | 1 | 1.3 | 1.3 | 53.3 | 53.3 |
| 8.92048 | 1 | 1.3 | 1.3 | 54.7 | 54.7 |
| 9.53493 | 1 | 1.3 | 1.3 | 56.0 | 56.0 |
| 9.53611 | 1 | 1.3 | 1.3 | 57.3 | 57.3 |
| 9.56251 | 1 | 1.3 | 1.3 | 58.7 | 58.7 |
| 9.61692 | 1 | 1.3 | 1.3 | 60.0 | 60.0 |
| 9.63616 | 1 | 1.3 | 1.3 | 61.3 | 61.3 |
| 9.84213 | 1 | 1.3 | 1.3 | 62.7 | 62.7 |
| 9.85736 | 1 | 1.3 | 1.3 | 64.0 | 64.0 |
| 10.01198 | 1 | 1.3 | 1.3 | 65.3 | 65.3 |
| 10.0131 | 1 | 1.3 | 1.3 | 66.7 | 66.7 |
| 10.21631 | 1 | 1.3 | 1.3 | 68.0 | 68.0 |
| 10.32968 | 1 | 1.3 | 1.3 | 69.3 | 69.3 |
| 10.73752 | 1 | 1.3 | 1.3 | 70.7 | 70.7 |
| 11.31047 | 1 | 1.3 | 1.3 | 72.0 | 72.0 |
| 11.74074 | 1 | 1.3 | 1.3 | 73.3 | 73.3 |
| 11.96524 | 1 | 1.3 | 1.3 | 74.7 | 74.7 |
| 12.18115 | 1 | 1.3 | 1.3 | 76.0 | 76.0 |
| 12.21952 | 1 | 1.3 | 1.3 | 77.3 | 77.3 |
| 12.33807 | 1 | 1.3 | 1.3 | 78.7 | 78.7 |
| 12.85801 | 1 | 1.3 | 1.3 | 80.0 | 80.0 |
| 13.48919 | 1 | 1.3 | 1.3 | 81.3 | 81.3 |
| 14.81614 | 1 | 1.3 | 1.3 | 82.7 | 82.7 |
| 15.05161 | 1 | 1.3 | 1.3 | 84.0 | 84.0 |
| 15.64997 | 1 | 1.3 | 1.3 | 85.3 | 85.3 |
| 16.24937 | 1 | 1.3 | 1.3 | 86.7 | 86.7 |
| 17.23264 | 1 | 1.3 | 1.3 | 88.0 | 88.0 |
| 17.65521 | 1 | 1.3 | 1.3 | 89.3 | 89.3 |
| 18.00524 | 1 | 1.3 | 1.3 | 90.7 | 90.7 |
| 19.28722 | 1 | 1.3 | 1.3 | 92.0 | 92.0 |
| 19.51432 | 1 | 1.3 | 1.3 | 93.3 | 93.3 |
| 19.54581 | 1 | 1.3 | 1.3 | 94.7 | 94.7 |
| 20.06633 | 1 | 1.3 | 1.3 | 96.0 | 96.0 |
| 21.67452 | 1 | 1.3 | 1.3 | 97.3 | 97.3 |
| 21.9547 | 1 | 1.3 | 1.3 | 98.7 | 98.7 |
| 22.32368 | 1 | 1.3 | 1.3 | 100.0 | 100.0 |
| Total | 75 | 100.0 | 100.0 | 100.0 | 100.0 |
str(table)
## Classes 'freqtab' and 'data.frame': 75 obs. of 5 variables:
## $ n : num 2 1 1 1 1 1 1 1 1 1 ...
## $ % : num 2.7 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 ...
## $ val% : num 2.7 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 ...
## $ %cum : num 2.7 4 5.3 6.7 8 9.3 10.7 12 13.3 14.7 ...
## $ val%cum: num 2.7 4 5.3 6.7 8 9.3 10.7 12 13.3 14.7 ...
x <- row.names(table)
y <- table$n
names <- x[1:(length(x)-1)]
freqs <- y[1:(length(y)-1)]
df_cr <- data.frame(x = names, y = freqs)
knitr::kable(df_cr)
| x | y |
|---|---|
| 0.25254 | 2 |
| 0.26208 | 1 |
| 0.35225 | 1 |
| 0.55804 | 1 |
| 0.70048 | 1 |
| 0.72957 | 1 |
| 1.16705 | 1 |
| 1.47396 | 1 |
| 1.85787 | 1 |
| 2.08469 | 1 |
| 2.92605 | 1 |
| 2.94804 | 1 |
| 3.07297 | 1 |
| 3.08459 | 1 |
| 3.08916 | 1 |
| 3.21979 | 1 |
| 3.67691 | 1 |
| 3.71407 | 1 |
| 3.82425 | 1 |
| 4.24199 | 1 |
| 4.57763 | 1 |
| 4.87432 | 1 |
| 4.89954 | 1 |
| 4.93053 | 1 |
| 5.12667 | 1 |
| 5.15142 | 1 |
| 5.365 | 1 |
| 5.43516 | 1 |
| 5.57523 | 1 |
| 5.95519 | 1 |
| 5.96634 | 1 |
| 6.49523 | 1 |
| 6.80061 | 1 |
| 6.88715 | 1 |
| 6.92174 | 1 |
| 7.87044 | 1 |
| 8.21372 | 1 |
| 8.27042 | 1 |
| 8.39161 | 1 |
| 8.92048 | 1 |
| 9.53493 | 1 |
| 9.53611 | 1 |
| 9.56251 | 1 |
| 9.61692 | 1 |
| 9.63616 | 1 |
| 9.84213 | 1 |
| 9.85736 | 1 |
| 10.01198 | 1 |
| 10.0131 | 1 |
| 10.21631 | 1 |
| 10.32968 | 1 |
| 10.73752 | 1 |
| 11.31047 | 1 |
| 11.74074 | 1 |
| 11.96524 | 1 |
| 12.18115 | 1 |
| 12.21952 | 1 |
| 12.33807 | 1 |
| 12.85801 | 1 |
| 13.48919 | 1 |
| 14.81614 | 1 |
| 15.05161 | 1 |
| 15.64997 | 1 |
| 16.24937 | 1 |
| 17.23264 | 1 |
| 17.65521 | 1 |
| 18.00524 | 1 |
| 19.28722 | 1 |
| 19.51432 | 1 |
| 19.54581 | 1 |
| 20.06633 | 1 |
| 21.67452 | 1 |
| 21.9547 | 1 |
| 22.32368 | 1 |
library(ggplot2)
ggplot(data=df_cr, aes(x=x, y=y)) +
geom_bar(stat="identity", color="white", fill="blue") +
xlab("Rango de deslizamiento") +
ylab("Frecuencia")
n_sturges = 1 + log(length(Distance))/log(2)
n_sturgesc = ceiling(n_sturges)
n_sturgesf = floor(n_sturges)
n_clases = 0
if (n_sturgesc%%2 == 0) {
n_clases = n_sturgesf
} else {
n_clases = n_sturgesc
}
R = max(Distance) - min(Distance)
w = ceiling(R/n_clases)
bins <- seq(min(Distance), max(Distance) + w, by = w)
bins
## [1] 0.25254 4.25254 8.25254 12.25254 16.25254 20.25254 24.25254
Edades <- cut(Distance, bins)
Freq_table <- transform(table(Distance), Rel_Freq=prop.table(Freq), Cum_Freq=cumsum(Freq))
knitr::kable(Freq_table)
| Distance | Freq | Rel_Freq | Cum_Freq |
|---|---|---|---|
| 0.25254 | 2 | 0.0266667 | 2 |
| 0.26208 | 1 | 0.0133333 | 3 |
| 0.35225 | 1 | 0.0133333 | 4 |
| 0.55804 | 1 | 0.0133333 | 5 |
| 0.70048 | 1 | 0.0133333 | 6 |
| 0.72957 | 1 | 0.0133333 | 7 |
| 1.16705 | 1 | 0.0133333 | 8 |
| 1.47396 | 1 | 0.0133333 | 9 |
| 1.85787 | 1 | 0.0133333 | 10 |
| 2.08469 | 1 | 0.0133333 | 11 |
| 2.92605 | 1 | 0.0133333 | 12 |
| 2.94804 | 1 | 0.0133333 | 13 |
| 3.07297 | 1 | 0.0133333 | 14 |
| 3.08459 | 1 | 0.0133333 | 15 |
| 3.08916 | 1 | 0.0133333 | 16 |
| 3.21979 | 1 | 0.0133333 | 17 |
| 3.67691 | 1 | 0.0133333 | 18 |
| 3.71407 | 1 | 0.0133333 | 19 |
| 3.82425 | 1 | 0.0133333 | 20 |
| 4.24199 | 1 | 0.0133333 | 21 |
| 4.57763 | 1 | 0.0133333 | 22 |
| 4.87432 | 1 | 0.0133333 | 23 |
| 4.89954 | 1 | 0.0133333 | 24 |
| 4.93053 | 1 | 0.0133333 | 25 |
| 5.12667 | 1 | 0.0133333 | 26 |
| 5.15142 | 1 | 0.0133333 | 27 |
| 5.365 | 1 | 0.0133333 | 28 |
| 5.43516 | 1 | 0.0133333 | 29 |
| 5.57523 | 1 | 0.0133333 | 30 |
| 5.95519 | 1 | 0.0133333 | 31 |
| 5.96634 | 1 | 0.0133333 | 32 |
| 6.49523 | 1 | 0.0133333 | 33 |
| 6.80061 | 1 | 0.0133333 | 34 |
| 6.88715 | 1 | 0.0133333 | 35 |
| 6.92174 | 1 | 0.0133333 | 36 |
| 7.87044 | 1 | 0.0133333 | 37 |
| 8.21372 | 1 | 0.0133333 | 38 |
| 8.27042 | 1 | 0.0133333 | 39 |
| 8.39161 | 1 | 0.0133333 | 40 |
| 8.92048 | 1 | 0.0133333 | 41 |
| 9.53493 | 1 | 0.0133333 | 42 |
| 9.53611 | 1 | 0.0133333 | 43 |
| 9.56251 | 1 | 0.0133333 | 44 |
| 9.61692 | 1 | 0.0133333 | 45 |
| 9.63616 | 1 | 0.0133333 | 46 |
| 9.84213 | 1 | 0.0133333 | 47 |
| 9.85736 | 1 | 0.0133333 | 48 |
| 10.01198 | 1 | 0.0133333 | 49 |
| 10.0131 | 1 | 0.0133333 | 50 |
| 10.21631 | 1 | 0.0133333 | 51 |
| 10.32968 | 1 | 0.0133333 | 52 |
| 10.73752 | 1 | 0.0133333 | 53 |
| 11.31047 | 1 | 0.0133333 | 54 |
| 11.74074 | 1 | 0.0133333 | 55 |
| 11.96524 | 1 | 0.0133333 | 56 |
| 12.18115 | 1 | 0.0133333 | 57 |
| 12.21952 | 1 | 0.0133333 | 58 |
| 12.33807 | 1 | 0.0133333 | 59 |
| 12.85801 | 1 | 0.0133333 | 60 |
| 13.48919 | 1 | 0.0133333 | 61 |
| 14.81614 | 1 | 0.0133333 | 62 |
| 15.05161 | 1 | 0.0133333 | 63 |
| 15.64997 | 1 | 0.0133333 | 64 |
| 16.24937 | 1 | 0.0133333 | 65 |
| 17.23264 | 1 | 0.0133333 | 66 |
| 17.65521 | 1 | 0.0133333 | 67 |
| 18.00524 | 1 | 0.0133333 | 68 |
| 19.28722 | 1 | 0.0133333 | 69 |
| 19.51432 | 1 | 0.0133333 | 70 |
| 19.54581 | 1 | 0.0133333 | 71 |
| 20.06633 | 1 | 0.0133333 | 72 |
| 21.67452 | 1 | 0.0133333 | 73 |
| 21.9547 | 1 | 0.0133333 | 74 |
| 22.32368 | 1 | 0.0133333 | 75 |
str(Freq_table)
## 'data.frame': 74 obs. of 4 variables:
## $ Distance: Factor w/ 74 levels "0.25254","0.26208",..: 1 2 3 4 5 6 7 8 9 10 ...
## $ Freq : int 2 1 1 1 1 1 1 1 1 1 ...
## $ Rel_Freq: num 0.0267 0.0133 0.0133 0.0133 0.0133 ...
## $ Cum_Freq: int 2 3 4 5 6 7 8 9 10 11 ...
df_cr <- data.frame(x = Freq_table$Distance, y = Freq_table$Freq)
knitr::kable(df_cr)
| x | y |
|---|---|
| 0.25254 | 2 |
| 0.26208 | 1 |
| 0.35225 | 1 |
| 0.55804 | 1 |
| 0.70048 | 1 |
| 0.72957 | 1 |
| 1.16705 | 1 |
| 1.47396 | 1 |
| 1.85787 | 1 |
| 2.08469 | 1 |
| 2.92605 | 1 |
| 2.94804 | 1 |
| 3.07297 | 1 |
| 3.08459 | 1 |
| 3.08916 | 1 |
| 3.21979 | 1 |
| 3.67691 | 1 |
| 3.71407 | 1 |
| 3.82425 | 1 |
| 4.24199 | 1 |
| 4.57763 | 1 |
| 4.87432 | 1 |
| 4.89954 | 1 |
| 4.93053 | 1 |
| 5.12667 | 1 |
| 5.15142 | 1 |
| 5.365 | 1 |
| 5.43516 | 1 |
| 5.57523 | 1 |
| 5.95519 | 1 |
| 5.96634 | 1 |
| 6.49523 | 1 |
| 6.80061 | 1 |
| 6.88715 | 1 |
| 6.92174 | 1 |
| 7.87044 | 1 |
| 8.21372 | 1 |
| 8.27042 | 1 |
| 8.39161 | 1 |
| 8.92048 | 1 |
| 9.53493 | 1 |
| 9.53611 | 1 |
| 9.56251 | 1 |
| 9.61692 | 1 |
| 9.63616 | 1 |
| 9.84213 | 1 |
| 9.85736 | 1 |
| 10.01198 | 1 |
| 10.0131 | 1 |
| 10.21631 | 1 |
| 10.32968 | 1 |
| 10.73752 | 1 |
| 11.31047 | 1 |
| 11.74074 | 1 |
| 11.96524 | 1 |
| 12.18115 | 1 |
| 12.21952 | 1 |
| 12.33807 | 1 |
| 12.85801 | 1 |
| 13.48919 | 1 |
| 14.81614 | 1 |
| 15.05161 | 1 |
| 15.64997 | 1 |
| 16.24937 | 1 |
| 17.23264 | 1 |
| 17.65521 | 1 |
| 18.00524 | 1 |
| 19.28722 | 1 |
| 19.51432 | 1 |
| 19.54581 | 1 |
| 20.06633 | 1 |
| 21.67452 | 1 |
| 21.9547 | 1 |
| 22.32368 | 1 |
library(ggplot2)
ggplot(data=df_cr, aes(x=x, y=y)) +
geom_bar(stat="identity", color="blue", fill="green") +
xlab("Rango de Distance") +
ylab("Frecuencia")
Estos se encargan de la toma de datos cuantitativa con respecto a la información proporcionada, los datos se calculan a partir de la media, mediana, moda, cuartiles etc.
summary(df_cr$Distance)
## Length Class Mode
## 0 NULL NULL
library(pastecs)
##
## Attaching package: 'pastecs'
## The following objects are masked from 'package:dplyr':
##
## first, last
stat.desc(df_cr)
## x y
## nbr.val NA 74.00000000
## nbr.null NA 0.00000000
## nbr.na NA 0.00000000
## min NA 1.00000000
## max NA 2.00000000
## range NA 1.00000000
## sum NA 75.00000000
## median NA 1.00000000
## mean NA 1.01351351
## SE.mean NA 0.01351351
## CI.mean NA 0.02693239
## var NA 0.01351351
## std.dev NA 0.11624764
## coef.var NA 0.11469767
boxplot(Distance, horizontal=TRUE, col='steelblue')
library(readr)
library(knitr)
df_sa <- subset (df, Country == "El Salvador")
knitr::kable(head(df_sa))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 34 | 230 | 9/5/07 | NA | El Salvador | SV | Ahuachapán | 7797 | Concepción de Ataco | 0.00273 | 13.8703 | -89.8486 | (13.8703, -89.848600000000005) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Felix | NA | NA | Azcentral.com | http://www.azcentral.com/news/articles/1108sr-fhsistercity1109-ON.html | ||
| 105 | 564 | 6/2/08 | NA | El Salvador | SV | La Libertad | 124694 | Santa Tecla | 4.96416 | 13.7205 | -89.2687 | (13.720499999999999, -89.268699999999995) | Landslide | Landslide | Medium | Tropical cyclone | Tropical Storm Arthur | NA | NA | http://news.xinhuanet.com/english/2008-06/04/content_8310737.htm | |||
| 224 | 1285 | 11/8/09 | NA | El Salvador | SV | San Vicente | 41504 | San Vicente | 7.60946 | 13.6409 | -88.8699 | (13.6409, -88.869900000000001) | Landslide | Complex | Very_large | Tropical cyclone | Tropical Cyclone Ida | NA | 23 | http://www.google.com/hostednews/ap/article/ALeqM5j0XCCb1n12DyhoBoDzGj_hTyEtrAD9BRKPRG0 | |||
| 225 | 1286 | 11/8/09 | NA | El Salvador | SV | La Libertad | 33767 | Antiguo Cuscatlán | 4.86219 | 13.7156 | -89.2521 | (13.7156, -89.252099999999999) | Landslide | Mudslide | Medium | Tropical cyclone | Tropical Cyclone Ida | NA | 4 | http://www.google.com/hostednews/ap/article/ALeqM5j0XCCb1n12DyhoBoDzGj_hTyEtrAD9BRKPRG0 | |||
| 226 | 1287 | 11/8/09 | NA | El Salvador | SV | San Vicente | 41504 | San Vicente | 5.90726 | 13.6094 | -88.8488 | (13.609400000000001, -88.848799999999997) | Landslide | Rockfall | Medium | Tropical cyclone | Tropical Cyclone Ida | NA | NA | http://news.bbc.co.uk/2/hi/in_depth/8349333.stm | |||
| 227 | 1288 | 11/8/09 | NA | El Salvador | SV | San Vicente | 41504 | San Vicente | 4.03125 | 13.6466 | -88.8347 | (13.646599999999999, -88.834699999999998) | Landslide | Mudslide | Medium | Tropical cyclone | Tropical Cyclone Ida | NA | NA | http://news.yahoo.com/s/afp/20091109/wl_afp/salvadorweatherstorm_20091109100952 |
df_sa %>%
select(Country, State, City, Distance)
## Country State City Distance
## 34 El Salvador Ahuachapán Concepción de Ataco 0.00273
## 105 El Salvador La Libertad Santa Tecla 4.96416
## 224 El Salvador San Vicente San Vicente 7.60946
## 225 El Salvador La Libertad Antiguo Cuscatlán 4.86219
## 226 El Salvador San Vicente San Vicente 5.90726
## 227 El Salvador San Vicente San Vicente 4.03125
## 453 El Salvador Ahuachapán Tacuba 5.29901
## 824 El Salvador San Salvador Apopa 3.01739
## 1294 El Salvador San Miguel Chirilagua 6.94536
## 1366 El Salvador San Miguel San Rafael Oriente 10.06695
## 1367 El Salvador Cabañas San Martín 8.82525
## 1369 El Salvador Sonsonate Nahuizalco 4.23875
## 1370 El Salvador Sonsonate Sonzacate 3.22235
## 1371 El Salvador La Paz San Pedro Masahuat 0.31933
## 1372 El Salvador San Miguel Chirilagua 9.97227
## 1373 El Salvador Santa Ana Coatepeque 8.83210
## 1374 El Salvador La Libertad Santa Tecla 4.60655
## 1375 El Salvador San Salvador Antiguo Cuscatlán 3.25227
## 1594 El Salvador Santa Ana Ciudad Arce 1.15810
## 1596 El Salvador La Libertad Santa Tecla 4.67722
## 1597 El Salvador La Libertad Santa Tecla 9.87553
## 1598 El Salvador Sonsonate Juayúa 0.49346
library(ggplot2)
ggplot(data=df_sa, aes(x= State , y= Distance)) + geom_bar(stat="identity", color="black", fill="purple")
library(ggplot2)
library(dplyr)
ggplot(data=df_sa, aes(fill=City, x="El Salvador", y=Distance)) +
geom_bar(position="dodge", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_sa, aes(fill=City, x="El Salvador", y=Distance)) +
geom_bar(position="stack", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_sa, aes(x = "El Salvador", y = Distance , fill=City)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y", start = 0)
library(qcc)
Distance <- df_sa$Distance
names(Distance) <- df_sa$City
pareto.chart(Distance,
ylab="Distance",
col = heat.colors(length(Distance)),
cumperc = seq(0, 100, by = 10),
ylab2 = "Porcentaje acumulado",
main = "DONDE SE CONCENTRAN LAS CIUDADES CON MAYORES DESLIZAMIENTOS")
##
## Pareto chart analysis for Distance
## Frequency Cum.Freq. Percentage Cum.Percent.
## San Rafael Oriente 1.006695e+01 1.006695e+01 8.974011e+00 8.974011e+00
## Chirilagua 9.972270e+00 2.003922e+01 8.889610e+00 1.786362e+01
## Santa Tecla 9.875530e+00 2.991475e+01 8.803373e+00 2.666699e+01
## Coatepeque 8.832100e+00 3.874685e+01 7.873225e+00 3.454022e+01
## San Martín 8.825250e+00 4.757210e+01 7.867118e+00 4.240734e+01
## San Vicente 7.609460e+00 5.518156e+01 6.783323e+00 4.919066e+01
## Chirilagua 6.945360e+00 6.212692e+01 6.191323e+00 5.538198e+01
## San Vicente 5.907260e+00 6.803418e+01 5.265926e+00 6.064791e+01
## Tacuba 5.299010e+00 7.333319e+01 4.723712e+00 6.537162e+01
## Santa Tecla 4.964160e+00 7.829735e+01 4.425216e+00 6.979684e+01
## Antiguo Cuscatlán 4.862190e+00 8.315954e+01 4.334316e+00 7.413115e+01
## Santa Tecla 4.677220e+00 8.783676e+01 4.169428e+00 7.830058e+01
## Santa Tecla 4.606550e+00 9.244331e+01 4.106430e+00 8.240701e+01
## Nahuizalco 4.238750e+00 9.668206e+01 3.778561e+00 8.618557e+01
## San Vicente 4.031250e+00 1.007133e+02 3.593589e+00 8.977916e+01
## Antiguo Cuscatlán 3.252270e+00 1.039656e+02 2.899181e+00 9.267834e+01
## Sonzacate 3.222350e+00 1.071879e+02 2.872509e+00 9.555085e+01
## Apopa 3.017390e+00 1.102053e+02 2.689801e+00 9.824065e+01
## Ciudad Arce 1.158100e+00 1.113634e+02 1.032368e+00 9.927302e+01
## Juayúa 4.934600e-01 1.118569e+02 4.398865e-01 9.971291e+01
## San Pedro Masahuat 3.193300e-01 1.121762e+02 2.846613e-01 9.999757e+01
## Concepción de Ataco 2.730000e-03 1.121789e+02 2.433612e-03 1.000000e+02
stem(df_sa$"Distance")
##
## The decimal point is 1 digit(s) to the right of the |
##
## 0 | 000133344
## 0 | 5555567899
## 1 | 000
head(df_sa)
## id date time continent_code Country country_code State
## 34 230 9/5/07 <NA> El Salvador SV Ahuachapán
## 105 564 6/2/08 <NA> El Salvador SV La Libertad
## 224 1285 11/8/09 <NA> El Salvador SV San Vicente
## 225 1286 11/8/09 <NA> El Salvador SV La Libertad
## 226 1287 11/8/09 <NA> El Salvador SV San Vicente
## 227 1288 11/8/09 <NA> El Salvador SV San Vicente
## population City Distance location_description latitude
## 34 7797 Concepción de Ataco 0.00273 13.8703
## 105 124694 Santa Tecla 4.96416 13.7205
## 224 41504 San Vicente 7.60946 13.6409
## 225 33767 Antiguo Cuscatlán 4.86219 13.7156
## 226 41504 San Vicente 5.90726 13.6094
## 227 41504 San Vicente 4.03125 13.6466
## longitude geolocation hazard_type
## 34 -89.8486 (13.8703, -89.848600000000005) Landslide
## 105 -89.2687 (13.720499999999999, -89.268699999999995) Landslide
## 224 -88.8699 (13.6409, -88.869900000000001) Landslide
## 225 -89.2521 (13.7156, -89.252099999999999) Landslide
## 226 -88.8488 (13.609400000000001, -88.848799999999997) Landslide
## 227 -88.8347 (13.646599999999999, -88.834699999999998) Landslide
## landslide_type landslide_size trigger storm_name
## 34 Mudslide Medium Tropical cyclone Hurricane Felix
## 105 Landslide Medium Tropical cyclone Tropical Storm Arthur
## 224 Complex Very_large Tropical cyclone Tropical Cyclone Ida
## 225 Mudslide Medium Tropical cyclone Tropical Cyclone Ida
## 226 Rockfall Medium Tropical cyclone Tropical Cyclone Ida
## 227 Mudslide Medium Tropical cyclone Tropical Cyclone Ida
## injuries fatalities source_name
## 34 NA NA Azcentral.com
## 105 NA NA
## 224 NA 23
## 225 NA 4
## 226 NA NA
## 227 NA NA
## source_link
## 34 http://www.azcentral.com/news/articles/1108sr-fhsistercity1109-ON.html
## 105 http://news.xinhuanet.com/english/2008-06/04/content_8310737.htm
## 224 http://www.google.com/hostednews/ap/article/ALeqM5j0XCCb1n12DyhoBoDzGj_hTyEtrAD9BRKPRG0
## 225 http://www.google.com/hostednews/ap/article/ALeqM5j0XCCb1n12DyhoBoDzGj_hTyEtrAD9BRKPRG0
## 226 http://news.bbc.co.uk/2/hi/in_depth/8349333.stm
## 227 http://news.yahoo.com/s/afp/20091109/wl_afp/salvadorweatherstorm_20091109100952
knitr::kable(head(df_sa))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 34 | 230 | 9/5/07 | NA | El Salvador | SV | Ahuachapán | 7797 | Concepción de Ataco | 0.00273 | 13.8703 | -89.8486 | (13.8703, -89.848600000000005) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Felix | NA | NA | Azcentral.com | http://www.azcentral.com/news/articles/1108sr-fhsistercity1109-ON.html | ||
| 105 | 564 | 6/2/08 | NA | El Salvador | SV | La Libertad | 124694 | Santa Tecla | 4.96416 | 13.7205 | -89.2687 | (13.720499999999999, -89.268699999999995) | Landslide | Landslide | Medium | Tropical cyclone | Tropical Storm Arthur | NA | NA | http://news.xinhuanet.com/english/2008-06/04/content_8310737.htm | |||
| 224 | 1285 | 11/8/09 | NA | El Salvador | SV | San Vicente | 41504 | San Vicente | 7.60946 | 13.6409 | -88.8699 | (13.6409, -88.869900000000001) | Landslide | Complex | Very_large | Tropical cyclone | Tropical Cyclone Ida | NA | 23 | http://www.google.com/hostednews/ap/article/ALeqM5j0XCCb1n12DyhoBoDzGj_hTyEtrAD9BRKPRG0 | |||
| 225 | 1286 | 11/8/09 | NA | El Salvador | SV | La Libertad | 33767 | Antiguo Cuscatlán | 4.86219 | 13.7156 | -89.2521 | (13.7156, -89.252099999999999) | Landslide | Mudslide | Medium | Tropical cyclone | Tropical Cyclone Ida | NA | 4 | http://www.google.com/hostednews/ap/article/ALeqM5j0XCCb1n12DyhoBoDzGj_hTyEtrAD9BRKPRG0 | |||
| 226 | 1287 | 11/8/09 | NA | El Salvador | SV | San Vicente | 41504 | San Vicente | 5.90726 | 13.6094 | -88.8488 | (13.609400000000001, -88.848799999999997) | Landslide | Rockfall | Medium | Tropical cyclone | Tropical Cyclone Ida | NA | NA | http://news.bbc.co.uk/2/hi/in_depth/8349333.stm | |||
| 227 | 1288 | 11/8/09 | NA | El Salvador | SV | San Vicente | 41504 | San Vicente | 4.03125 | 13.6466 | -88.8347 | (13.646599999999999, -88.834699999999998) | Landslide | Mudslide | Medium | Tropical cyclone | Tropical Cyclone Ida | NA | NA | http://news.yahoo.com/s/afp/20091109/wl_afp/salvadorweatherstorm_20091109100952 |
stem(df_sa$"Distance")
##
## The decimal point is 1 digit(s) to the right of the |
##
## 0 | 000133344
## 0 | 5555567899
## 1 | 000
stem(df_sa$"Distance", scale = 2)
##
## The decimal point is at the |
##
## 0 | 0352
## 2 | 023
## 4 | 02679039
## 6 | 96
## 8 | 889
## 10 | 01
library(forecast)
data<- ts(df_sa$Distance, frequency=12, start=2008)
knitr::kable(head(data))
| x |
|---|
| 0.00273 |
| 4.96416 |
| 7.60946 |
| 4.86219 |
| 5.90726 |
| 4.03125 |
autoplot(data) + labs(title = "Gráfico de series temporales", x="date", y = "distancia", colour = "green") +theme_bw()
library(questionr)
table <- questionr::freq(Distance, cum = TRUE, sort = "dec", total = TRUE)
knitr::kable(table)
| n | % | val% | %cum | val%cum | |
|---|---|---|---|---|---|
| 0.00273 | 1 | 4.5 | 4.5 | 4.5 | 4.5 |
| 0.31933 | 1 | 4.5 | 4.5 | 9.1 | 9.1 |
| 0.49346 | 1 | 4.5 | 4.5 | 13.6 | 13.6 |
| 1.1581 | 1 | 4.5 | 4.5 | 18.2 | 18.2 |
| 3.01739 | 1 | 4.5 | 4.5 | 22.7 | 22.7 |
| 3.22235 | 1 | 4.5 | 4.5 | 27.3 | 27.3 |
| 3.25227 | 1 | 4.5 | 4.5 | 31.8 | 31.8 |
| 4.03125 | 1 | 4.5 | 4.5 | 36.4 | 36.4 |
| 4.23875 | 1 | 4.5 | 4.5 | 40.9 | 40.9 |
| 4.60655 | 1 | 4.5 | 4.5 | 45.5 | 45.5 |
| 4.67722 | 1 | 4.5 | 4.5 | 50.0 | 50.0 |
| 4.86219 | 1 | 4.5 | 4.5 | 54.5 | 54.5 |
| 4.96416 | 1 | 4.5 | 4.5 | 59.1 | 59.1 |
| 5.29901 | 1 | 4.5 | 4.5 | 63.6 | 63.6 |
| 5.90726 | 1 | 4.5 | 4.5 | 68.2 | 68.2 |
| 6.94536 | 1 | 4.5 | 4.5 | 72.7 | 72.7 |
| 7.60946 | 1 | 4.5 | 4.5 | 77.3 | 77.3 |
| 8.82525 | 1 | 4.5 | 4.5 | 81.8 | 81.8 |
| 8.8321 | 1 | 4.5 | 4.5 | 86.4 | 86.4 |
| 9.87553 | 1 | 4.5 | 4.5 | 90.9 | 90.9 |
| 9.97227 | 1 | 4.5 | 4.5 | 95.5 | 95.5 |
| 10.06695 | 1 | 4.5 | 4.5 | 100.0 | 100.0 |
| Total | 22 | 100.0 | 100.0 | 100.0 | 100.0 |
str(table)
## Classes 'freqtab' and 'data.frame': 23 obs. of 5 variables:
## $ n : num 1 1 1 1 1 1 1 1 1 1 ...
## $ % : num 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 ...
## $ val% : num 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5 ...
## $ %cum : num 4.5 9.1 13.6 18.2 22.7 27.3 31.8 36.4 40.9 45.5 ...
## $ val%cum: num 4.5 9.1 13.6 18.2 22.7 27.3 31.8 36.4 40.9 45.5 ...
x <- row.names(table)
y <- table$n
names <- x[1:(length(x)-1)]
freqs <- y[1:(length(y)-1)]
df_sa <- data.frame(x = names, y = freqs)
knitr::kable(df_sa)
| x | y |
|---|---|
| 0.00273 | 1 |
| 0.31933 | 1 |
| 0.49346 | 1 |
| 1.1581 | 1 |
| 3.01739 | 1 |
| 3.22235 | 1 |
| 3.25227 | 1 |
| 4.03125 | 1 |
| 4.23875 | 1 |
| 4.60655 | 1 |
| 4.67722 | 1 |
| 4.86219 | 1 |
| 4.96416 | 1 |
| 5.29901 | 1 |
| 5.90726 | 1 |
| 6.94536 | 1 |
| 7.60946 | 1 |
| 8.82525 | 1 |
| 8.8321 | 1 |
| 9.87553 | 1 |
| 9.97227 | 1 |
| 10.06695 | 1 |
library(ggplot2)
ggplot(data=df_sa, aes(x=x, y=y)) +
geom_bar(stat="identity", color="white", fill="blue") +
xlab("Número de asistencias") +
ylab("Frecuencia")
n_sturges = 1 + log(length(Distance))/log(2)
n_sturgesc = ceiling(n_sturges)
n_sturgesf = floor(n_sturges)
n_clases = 0
if (n_sturgesc%%2 == 0) {
n_clases = n_sturgesf
} else {
n_clases = n_sturgesc
}
R = max(Distance) - min(Distance)
w = ceiling(R/n_clases)
bins <- seq(min(Distance), max(Distance) + w, by = w)
bins
## [1] 0.00273 3.00273 6.00273 9.00273 12.00273
Edades <- cut(Distance, bins)
Freq_table <- transform(table(Distance), Rel_Freq=prop.table(Freq), Cum_Freq=cumsum(Freq))
knitr::kable(Freq_table)
| Distance | Freq | Rel_Freq | Cum_Freq |
|---|---|---|---|
| 0.00273 | 1 | 0.0454545 | 1 |
| 0.31933 | 1 | 0.0454545 | 2 |
| 0.49346 | 1 | 0.0454545 | 3 |
| 1.1581 | 1 | 0.0454545 | 4 |
| 3.01739 | 1 | 0.0454545 | 5 |
| 3.22235 | 1 | 0.0454545 | 6 |
| 3.25227 | 1 | 0.0454545 | 7 |
| 4.03125 | 1 | 0.0454545 | 8 |
| 4.23875 | 1 | 0.0454545 | 9 |
| 4.60655 | 1 | 0.0454545 | 10 |
| 4.67722 | 1 | 0.0454545 | 11 |
| 4.86219 | 1 | 0.0454545 | 12 |
| 4.96416 | 1 | 0.0454545 | 13 |
| 5.29901 | 1 | 0.0454545 | 14 |
| 5.90726 | 1 | 0.0454545 | 15 |
| 6.94536 | 1 | 0.0454545 | 16 |
| 7.60946 | 1 | 0.0454545 | 17 |
| 8.82525 | 1 | 0.0454545 | 18 |
| 8.8321 | 1 | 0.0454545 | 19 |
| 9.87553 | 1 | 0.0454545 | 20 |
| 9.97227 | 1 | 0.0454545 | 21 |
| 10.06695 | 1 | 0.0454545 | 22 |
str(Freq_table)
## 'data.frame': 22 obs. of 4 variables:
## $ Distance: Factor w/ 22 levels "0.00273","0.31933",..: 1 2 3 4 5 6 7 8 9 10 ...
## $ Freq : int 1 1 1 1 1 1 1 1 1 1 ...
## $ Rel_Freq: num 0.0455 0.0455 0.0455 0.0455 0.0455 ...
## $ Cum_Freq: int 1 2 3 4 5 6 7 8 9 10 ...
df_sa <- data.frame(x = Freq_table$Distance, y = Freq_table$Freq)
knitr::kable(df_sa)
| x | y |
|---|---|
| 0.00273 | 1 |
| 0.31933 | 1 |
| 0.49346 | 1 |
| 1.1581 | 1 |
| 3.01739 | 1 |
| 3.22235 | 1 |
| 3.25227 | 1 |
| 4.03125 | 1 |
| 4.23875 | 1 |
| 4.60655 | 1 |
| 4.67722 | 1 |
| 4.86219 | 1 |
| 4.96416 | 1 |
| 5.29901 | 1 |
| 5.90726 | 1 |
| 6.94536 | 1 |
| 7.60946 | 1 |
| 8.82525 | 1 |
| 8.8321 | 1 |
| 9.87553 | 1 |
| 9.97227 | 1 |
| 10.06695 | 1 |
library(ggplot2)
ggplot(data=df_sa, aes(x=x, y=y)) +
geom_bar(stat="identity", color="black", fill="green") +
xlab("Rango de Distance") +
ylab("Frecuencia")
Estos se encargan de la toma de datos cuantitativa con respecto a la información proporcionada, los datos se calculan a partir de la media, mediana, moda, cuartiles etc.
summary(df_sa$Distance)
## Length Class Mode
## 0 NULL NULL
library(pastecs)
stat.desc(df_sa)
## x y
## nbr.val NA 22
## nbr.null NA 0
## nbr.na NA 0
## min NA 1
## max NA 1
## range NA 0
## sum NA 22
## median NA 1
## mean NA 1
## SE.mean NA 0
## CI.mean NA 0
## var NA 0
## std.dev NA 0
## coef.var NA 0
boxplot(Distance, horizontal=TRUE, col='steelblue')
library(readr)
library(knitr)
df_gu <- subset (df, Country == "Guatemala")
knitr::kable(head(df_gu))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 17 | 165 | 8/9/07 | NA | Guatemala | GT | Guatemala | 47247 | San José Pinula | 4.74385 | 14.5667 | -90.4500 | (14.566700000000001, -90.45) | Landslide | Mudslide | Medium | Rain | NA | 5 | International Herald | http://www.iht.com/articles/ap/2007/08/09/america/LA-GEN-Guatemala-Deadly-Mudslide.php | |||
| 27 | 198 | 8/21/07 | NA | Guatemala | GT | Alta Verapaz | 2006 | Lanquín | 13.39817 | 15.6046 | -90.0853 | (15.6046, -90.085300000000004) | Landslide | Landslide | Medium | Tropical cyclone | Hurricane Dean | NA | NA | United Nations Development Programme - Relief Web | http://www.reliefweb.int/rw/RWB.NSF/db900SID/EDIS-76BSG6?OpenDocument | ||
| 28 | 199 | 8/21/07 | NA | Guatemala | GT | Izabal | 18994 | Morales | 12.55184 | 15.5163 | -88.9286 | (15.516299999999999, -88.928600000000003) | Landslide | Landslide | Medium | Tropical cyclone | Hurricane Dean | NA | NA | United Nations Development Programme - Relief Web | http://www.reliefweb.int/rw/RWB.NSF/db900SID/EDIS-76BSG6?OpenDocument | ||
| 41 | 277 | 9/22/07 | NA | Guatemala | GT | Guatemala | 994938 | Guatemala City | 2.79113 | 14.6229 | -90.5316 | (14.6229, -90.531599999999997) | Landslide | Mudslide | Medium | Rain | NA | 3 | Fox News | http://www.foxnews.com/story/0,2933,297714,00.html | |||
| 104 | 563 | 6/1/08 | NA | Guatemala | GT | Escuintla | 31329 | Palín | 3.10150 | 14.4226 | -90.6755 | (14.422599999999999, -90.6755) | Landslide | Mudslide | Medium | Tropical cyclone | Tropical Storm Arthur | NA | 1 | http://209.85.215.104/search?q=cache:QU_lPxNfk78J:www.plenglish.com/article.asp?ID=%7B1D4A74F7-CDCA-49D0-ABD4-D2E0FD9D2130%7D&language=EN+Colom+said+the+declaration+came+after+a+death+in+Palin+and+40+houses+partially&hl=en&ct=clnk&cd=1&gl=us&c | |||
| 108 | 591 | 6/18/08 | NA | Guatemala | GT | Guatemala | 994938 | Guatemala City | 3.12614 | 14.6510 | -90.5403 | (14.651, -90.540300000000002) | Landslide | Complex | Medium | Rain | NA | 8 | http://cnnwire.blogs.cnn.com/2008/06/20/8-dead-in-rough-weather-in-guatemala/ |
df_gu %>%
select(Country, State, City, Distance)
## Country State City Distance
## 17 Guatemala Guatemala San José Pinula 4.74385
## 27 Guatemala Alta Verapaz Lanquín 13.39817
## 28 Guatemala Izabal Morales 12.55184
## 41 Guatemala Guatemala Guatemala City 2.79113
## 104 Guatemala Escuintla Palín 3.10150
## 108 Guatemala Guatemala Guatemala City 3.12614
## 120 Guatemala Zacapa La Unión 0.80640
## 158 Guatemala Chimaltenango San José Poaquil 5.31511
## 162 Guatemala Huehuetenango San Sebastián Huehuetenango 1.58358
## 169 Guatemala Izabal Morales 23.92309
## 351 Guatemala Quetzaltenango Almolonga 0.77254
## 353 Guatemala Escuintla Palín 0.18542
## 354 Guatemala Guatemala Amatitlán 2.02891
## 355 Guatemala Guatemala Chinautla 0.44764
## 356 Guatemala Sacatepéquez Santa María De Jesús 6.13527
## 357 Guatemala Guatemala Guatemala City 4.07930
## 358 Guatemala Sololá Santa Cruz La Laguna 6.00513
## 359 Guatemala Chimaltenango Santa Apolonia 0.99952
## 360 Guatemala Sololá San Pedro La Laguna 0.50611
## 361 Guatemala Guatemala San José Pinula 0.89040
## 362 Guatemala Quiché San Juan Cotzal 8.93658
## 363 Guatemala Totonicapán Totonicapán 0.17513
## 372 Guatemala Sololá San Pablo La Laguna 3.85753
## 383 Guatemala Guatemala Chinautla 3.85648
## 427 Guatemala Guatemala Mixco 2.10418
## 428 Guatemala Guatemala Mixco 3.64749
## 429 Guatemala Guatemala Santa Catarina Pinula 2.81128
## 430 Guatemala Chiquimula San Juan Ermita 6.15103
## 431 Guatemala Huehuetenango Malacatancito 0.03280
## 432 Guatemala Sololá San Andrés Semetabaj 0.00359
## 433 Guatemala Alta Verapaz Senahú 2.30104
## 437 Guatemala Sololá Nahualá 3.04642
## 438 Guatemala Quetzaltenango Colomba 0.92729
## 439 Guatemala Quiché Chicamán 21.83272
## 440 Guatemala Sacatepéquez Jocotenango 0.63089
## 441 Guatemala Chimaltenango Chimaltenango 1.36473
## 442 Guatemala Quiché Sacapulas 0.35171
## 818 Guatemala Huehuetenango Barillas 0.45507
## 885 Guatemala Quiché Chajul 7.39906
## 1112 Guatemala San Marcos Pajapita 0.96647
## 1244 Guatemala Huehuetenango San Pedro Necta 0.91108
## 1347 Guatemala Sololá Zunil 7.03115
## 1352 Guatemala Baja Verapaz Purulhá 5.88787
## 1353 Guatemala Guatemala Santa Catarina Pinula 2.70053
## 1354 Guatemala Guatemala Guatemala City 2.59620
## 1356 Guatemala Quiché San Luis Ixcán 22.56101
## 1357 Guatemala Jutiapa Jalpatagua 4.51954
## 1358 Guatemala Huehuetenango Cuilco 3.30989
## 1359 Guatemala Guatemala Chinautla 5.94535
## 1360 Guatemala Quiché Chinique 3.98185
## 1361 Guatemala San Marcos Tacaná 0.75729
## 1557 Guatemala Guatemala Santa Catarina Pinula 0.94245
## 1559 Guatemala Guatemala Santa Catarina Pinula 3.96161
## 1560 Guatemala Santa Rosa Santa María Ixhuatán 0.82332
## 1561 Guatemala Suchitepeque San Juan Bautista 3.47803
## 1568 Guatemala Guatemala Fraijanes 6.19218
## 1569 Guatemala Chimaltenango Patzicía 5.52205
## 1570 Guatemala Guatemala Mixco 1.87009
## 1571 Guatemala Guatemala Petapa 4.20726
## 1572 Guatemala Sololá San Antonio Palopó 3.18658
## 1573 Guatemala Sololá San Andrés Semetabaj 0.67040
## 1574 Guatemala Guatemala Guatemala City 3.80312
## 1575 Guatemala Guatemala Guatemala City 1.68290
## 1576 Guatemala Guatemala Guatemala City 2.08425
## 1577 Guatemala Guatemala Guatemala City 3.25675
## 1578 Guatemala Guatemala Guatemala City 3.49341
## 1579 Guatemala Guatemala Guatemala City 1.83863
## 1580 Guatemala Guatemala Guatemala City 1.57381
## 1581 Guatemala Guatemala Guatemala City 1.70147
## 1582 Guatemala Guatemala Guatemala City 3.00314
## 1583 Guatemala Quiché Chichicastenango 2.27725
## 1584 Guatemala Guatemala Chinautla 2.36376
## 1585 Guatemala Guatemala Chinautla 2.66358
## 1588 Guatemala Sacatepéquez Santa Catarina Barahona 1.45200
## 1589 Guatemala Alta Verapaz Cahabón 5.14479
## 1590 Guatemala Escuintla Nueva Concepción 8.25465
## 1591 Guatemala Guatemala Villa Canales 0.65744
## 1592 Guatemala Sololá San Andrés Semetabaj 0.75685
## 1595 Guatemala Quetzaltenango Coatepeque 1.81216
library(ggplot2)
ggplot(data=df_gu, aes(x= State , y= Distance)) + geom_bar(stat="identity", color="black", fill="purple")
library(ggplot2)
library(dplyr)
ggplot(data=df_gu, aes(fill=City, x="Guatemala", y=Distance)) +
geom_bar(position="dodge", stat="identity")
library(ggplot2)
library(dplyr)
ggplot(data=df_gu, aes(fill=City, x="Guatemala", y=Distance)) +
geom_bar(position="stack", stat="identity")
library(ggplot2)
library(dplyr)
ggplot(data=df_gu, aes(x = "Guatemala", y = Distance , fill=City)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y", start = 0)
library(qcc)
Distance <- df_gu$Distance
names(Distance) <- df_gu$City
pareto.chart(Distance,
ylab="Distance",
col = heat.colors(length(Distance)),
cumperc = seq(0, 100, by = 10),
ylab2 = "Porcentaje acumulado",
main = "DONDE SE CONCENTRAN LAS CIUDADES CON MAYORES DESLIZAMIENTOS")
##
## Pareto chart analysis for Distance
## Frequency Cum.Freq. Percentage
## Morales 2.392309e+01 2.392309e+01 7.892330e+00
## San Luis Ixcán 2.256101e+01 4.648410e+01 7.442974e+00
## Chicamán 2.183272e+01 6.831682e+01 7.202708e+00
## Lanquín 1.339817e+01 8.171499e+01 4.420114e+00
## Morales 1.255184e+01 9.426683e+01 4.140906e+00
## San Juan Cotzal 8.936580e+00 1.032034e+02 2.948216e+00
## Nueva Concepción 8.254650e+00 1.114581e+02 2.723244e+00
## Chajul 7.399060e+00 1.188571e+02 2.440982e+00
## Zunil 7.031150e+00 1.258883e+02 2.319606e+00
## Fraijanes 6.192180e+00 1.320804e+02 2.042827e+00
## San Juan Ermita 6.151030e+00 1.382315e+02 2.029251e+00
## Santa María De Jesús 6.135270e+00 1.443667e+02 2.024052e+00
## Santa Cruz La Laguna 6.005130e+00 1.503719e+02 1.981118e+00
## Chinautla 5.945350e+00 1.563172e+02 1.961396e+00
## Purulhá 5.887870e+00 1.622051e+02 1.942433e+00
## Patzicía 5.522050e+00 1.677271e+02 1.821748e+00
## San José Poaquil 5.315110e+00 1.730423e+02 1.753478e+00
## Cahabón 5.144790e+00 1.781870e+02 1.697288e+00
## San José Pinula 4.743850e+00 1.829309e+02 1.565016e+00
## Jalpatagua 4.519540e+00 1.874504e+02 1.491016e+00
## Petapa 4.207260e+00 1.916577e+02 1.387993e+00
## Guatemala City 4.079300e+00 1.957370e+02 1.345779e+00
## Chinique 3.981850e+00 1.997189e+02 1.313629e+00
## Santa Catarina Pinula 3.961610e+00 2.036805e+02 1.306952e+00
## San Pablo La Laguna 3.857530e+00 2.075380e+02 1.272616e+00
## Chinautla 3.856480e+00 2.113945e+02 1.272269e+00
## Guatemala City 3.803120e+00 2.151976e+02 1.254666e+00
## Mixco 3.647490e+00 2.188451e+02 1.203323e+00
## Guatemala City 3.493410e+00 2.223385e+02 1.152491e+00
## San Juan Bautista 3.478030e+00 2.258165e+02 1.147417e+00
## Cuilco 3.309890e+00 2.291264e+02 1.091947e+00
## Guatemala City 3.256750e+00 2.323832e+02 1.074416e+00
## San Antonio Palopó 3.186580e+00 2.355697e+02 1.051266e+00
## Guatemala City 3.126140e+00 2.386959e+02 1.031327e+00
## Palín 3.101500e+00 2.417974e+02 1.023198e+00
## Nahualá 3.046420e+00 2.448438e+02 1.005027e+00
## Guatemala City 3.003140e+00 2.478469e+02 9.907487e-01
## Santa Catarina Pinula 2.811280e+00 2.506582e+02 9.274533e-01
## Guatemala City 2.791130e+00 2.534494e+02 9.208057e-01
## Santa Catarina Pinula 2.700530e+00 2.561499e+02 8.909164e-01
## Chinautla 2.663580e+00 2.588135e+02 8.787264e-01
## Guatemala City 2.596200e+00 2.614097e+02 8.564975e-01
## Chinautla 2.363760e+00 2.637734e+02 7.798145e-01
## Senahú 2.301040e+00 2.660745e+02 7.591229e-01
## Chichicastenango 2.277250e+00 2.683517e+02 7.512745e-01
## Mixco 2.104180e+00 2.704559e+02 6.941780e-01
## Guatemala City 2.084250e+00 2.725401e+02 6.876030e-01
## Amatitlán 2.028910e+00 2.745691e+02 6.693461e-01
## Mixco 1.870090e+00 2.764391e+02 6.169507e-01
## Guatemala City 1.838630e+00 2.782778e+02 6.065719e-01
## Coatepeque 1.812160e+00 2.800899e+02 5.978393e-01
## Guatemala City 1.701470e+00 2.817914e+02 5.613222e-01
## Guatemala City 1.682900e+00 2.834743e+02 5.551959e-01
## San Sebastián Huehuetenango 1.583580e+00 2.850579e+02 5.224298e-01
## Guatemala City 1.573810e+00 2.866317e+02 5.192066e-01
## Santa Catarina Barahona 1.452000e+00 2.880837e+02 4.790210e-01
## Chimaltenango 1.364730e+00 2.894484e+02 4.502303e-01
## Santa Apolonia 9.995200e-01 2.904479e+02 3.297459e-01
## Pajapita 9.664700e-01 2.914144e+02 3.188426e-01
## Santa Catarina Pinula 9.424500e-01 2.923569e+02 3.109183e-01
## Colomba 9.272900e-01 2.932842e+02 3.059169e-01
## San Pedro Necta 9.110800e-01 2.941952e+02 3.005692e-01
## San José Pinula 8.904000e-01 2.950856e+02 2.937468e-01
## Santa María Ixhuatán 8.233200e-01 2.959090e+02 2.716168e-01
## La Unión 8.064000e-01 2.967154e+02 2.660348e-01
## Almolonga 7.725400e-01 2.974879e+02 2.548642e-01
## Tacaná 7.572900e-01 2.982452e+02 2.498332e-01
## San Andrés Semetabaj 7.568500e-01 2.990020e+02 2.496881e-01
## San Andrés Semetabaj 6.704000e-01 2.996724e+02 2.211678e-01
## Villa Canales 6.574400e-01 3.003299e+02 2.168923e-01
## Jocotenango 6.308900e-01 3.009608e+02 2.081333e-01
## San Pedro La Laguna 5.061100e-01 3.014669e+02 1.669679e-01
## Barillas 4.550700e-01 3.019219e+02 1.501295e-01
## Chinautla 4.476400e-01 3.023696e+02 1.476783e-01
## Sacapulas 3.517100e-01 3.027213e+02 1.160306e-01
## Palín 1.854200e-01 3.029067e+02 6.117085e-02
## Totonicapán 1.751300e-01 3.030818e+02 5.777614e-02
## Malacatancito 3.280000e-02 3.031146e+02 1.082086e-02
## San Andrés Semetabaj 3.590000e-03 3.031182e+02 1.184356e-03
##
## Pareto chart analysis for Distance
## Cum.Percent.
## Morales 7.892330e+00
## San Luis Ixcán 1.533530e+01
## Chicamán 2.253801e+01
## Lanquín 2.695812e+01
## Morales 3.109903e+01
## San Juan Cotzal 3.404725e+01
## Nueva Concepción 3.677049e+01
## Chajul 3.921147e+01
## Zunil 4.153108e+01
## Fraijanes 4.357391e+01
## San Juan Ermita 4.560316e+01
## Santa María De Jesús 4.762721e+01
## Santa Cruz La Laguna 4.960833e+01
## Chinautla 5.156972e+01
## Purulhá 5.351216e+01
## Patzicía 5.533390e+01
## San José Poaquil 5.708738e+01
## Cahabón 5.878467e+01
## San José Pinula 6.034969e+01
## Jalpatagua 6.184070e+01
## Petapa 6.322869e+01
## Guatemala City 6.457447e+01
## Chinique 6.588810e+01
## Santa Catarina Pinula 6.719505e+01
## San Pablo La Laguna 6.846767e+01
## Chinautla 6.973994e+01
## Guatemala City 7.099460e+01
## Mixco 7.219793e+01
## Guatemala City 7.335042e+01
## San Juan Bautista 7.449784e+01
## Cuilco 7.558978e+01
## Guatemala City 7.666420e+01
## San Antonio Palopó 7.771546e+01
## Guatemala City 7.874679e+01
## Palín 7.976999e+01
## Nahualá 8.077502e+01
## Guatemala City 8.176577e+01
## Santa Catarina Pinula 8.269322e+01
## Guatemala City 8.361402e+01
## Santa Catarina Pinula 8.450494e+01
## Chinautla 8.538367e+01
## Guatemala City 8.624016e+01
## Chinautla 8.701998e+01
## Senahú 8.777910e+01
## Chichicastenango 8.853038e+01
## Mixco 8.922455e+01
## Guatemala City 8.991216e+01
## Amatitlán 9.058150e+01
## Mixco 9.119845e+01
## Guatemala City 9.180503e+01
## Coatepeque 9.240287e+01
## Guatemala City 9.296419e+01
## Guatemala City 9.351938e+01
## San Sebastián Huehuetenango 9.404181e+01
## Guatemala City 9.456102e+01
## Santa Catarina Barahona 9.504004e+01
## Chimaltenango 9.549027e+01
## Santa Apolonia 9.582002e+01
## Pajapita 9.613886e+01
## Santa Catarina Pinula 9.644978e+01
## Colomba 9.675569e+01
## San Pedro Necta 9.705626e+01
## San José Pinula 9.735001e+01
## Santa María Ixhuatán 9.762163e+01
## La Unión 9.788766e+01
## Almolonga 9.814253e+01
## Tacaná 9.839236e+01
## San Andrés Semetabaj 9.864205e+01
## San Andrés Semetabaj 9.886322e+01
## Villa Canales 9.908011e+01
## Jocotenango 9.928824e+01
## San Pedro La Laguna 9.945521e+01
## Barillas 9.960534e+01
## Chinautla 9.975302e+01
## Sacapulas 9.986905e+01
## Palín 9.993022e+01
## Totonicapán 9.998799e+01
## Malacatancito 9.999882e+01
## San Andrés Semetabaj 1.000000e+02
stem(df_gu$"Distance")
##
## The decimal point is at the |
##
## 0 | 0022445567788888999900456677889
## 2 | 011334677880011233556899
## 4 | 00125713599
## 6 | 012204
## 8 | 39
## 10 |
## 12 | 64
## 14 |
## 16 |
## 18 |
## 20 | 8
## 22 | 69
head(df_gu)
## id date time continent_code Country country_code State
## 17 165 8/9/07 <NA> Guatemala GT Guatemala
## 27 198 8/21/07 <NA> Guatemala GT Alta Verapaz
## 28 199 8/21/07 <NA> Guatemala GT Izabal
## 41 277 9/22/07 <NA> Guatemala GT Guatemala
## 104 563 6/1/08 <NA> Guatemala GT Escuintla
## 108 591 6/18/08 <NA> Guatemala GT Guatemala
## population City Distance location_description latitude longitude
## 17 47247 San José Pinula 4.74385 14.5667 -90.4500
## 27 2006 Lanquín 13.39817 15.6046 -90.0853
## 28 18994 Morales 12.55184 15.5163 -88.9286
## 41 994938 Guatemala City 2.79113 14.6229 -90.5316
## 104 31329 Palín 3.10150 14.4226 -90.6755
## 108 994938 Guatemala City 3.12614 14.6510 -90.5403
## geolocation hazard_type landslide_type
## 17 (14.566700000000001, -90.45) Landslide Mudslide
## 27 (15.6046, -90.085300000000004) Landslide Landslide
## 28 (15.516299999999999, -88.928600000000003) Landslide Landslide
## 41 (14.6229, -90.531599999999997) Landslide Mudslide
## 104 (14.422599999999999, -90.6755) Landslide Mudslide
## 108 (14.651, -90.540300000000002) Landslide Complex
## landslide_size trigger storm_name injuries fatalities
## 17 Medium Rain NA 5
## 27 Medium Tropical cyclone Hurricane Dean NA NA
## 28 Medium Tropical cyclone Hurricane Dean NA NA
## 41 Medium Rain NA 3
## 104 Medium Tropical cyclone Tropical Storm Arthur NA 1
## 108 Medium Rain NA 8
## source_name
## 17 International Herald
## 27 United Nations Development Programme - Relief Web
## 28 United Nations Development Programme - Relief Web
## 41 Fox News
## 104
## 108
## source_link
## 17 http://www.iht.com/articles/ap/2007/08/09/america/LA-GEN-Guatemala-Deadly-Mudslide.php
## 27 http://www.reliefweb.int/rw/RWB.NSF/db900SID/EDIS-76BSG6?OpenDocument
## 28 http://www.reliefweb.int/rw/RWB.NSF/db900SID/EDIS-76BSG6?OpenDocument
## 41 http://www.foxnews.com/story/0,2933,297714,00.html
## 104 http://209.85.215.104/search?q=cache:QU_lPxNfk78J:www.plenglish.com/article.asp?ID=%7B1D4A74F7-CDCA-49D0-ABD4-D2E0FD9D2130%7D&language=EN+Colom+said+the+declaration+came+after+a+death+in+Palin+and+40+houses+partially&hl=en&ct=clnk&cd=1&gl=us&c
## 108 http://cnnwire.blogs.cnn.com/2008/06/20/8-dead-in-rough-weather-in-guatemala/
knitr::kable(head(df_gu))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 17 | 165 | 8/9/07 | NA | Guatemala | GT | Guatemala | 47247 | San José Pinula | 4.74385 | 14.5667 | -90.4500 | (14.566700000000001, -90.45) | Landslide | Mudslide | Medium | Rain | NA | 5 | International Herald | http://www.iht.com/articles/ap/2007/08/09/america/LA-GEN-Guatemala-Deadly-Mudslide.php | |||
| 27 | 198 | 8/21/07 | NA | Guatemala | GT | Alta Verapaz | 2006 | Lanquín | 13.39817 | 15.6046 | -90.0853 | (15.6046, -90.085300000000004) | Landslide | Landslide | Medium | Tropical cyclone | Hurricane Dean | NA | NA | United Nations Development Programme - Relief Web | http://www.reliefweb.int/rw/RWB.NSF/db900SID/EDIS-76BSG6?OpenDocument | ||
| 28 | 199 | 8/21/07 | NA | Guatemala | GT | Izabal | 18994 | Morales | 12.55184 | 15.5163 | -88.9286 | (15.516299999999999, -88.928600000000003) | Landslide | Landslide | Medium | Tropical cyclone | Hurricane Dean | NA | NA | United Nations Development Programme - Relief Web | http://www.reliefweb.int/rw/RWB.NSF/db900SID/EDIS-76BSG6?OpenDocument | ||
| 41 | 277 | 9/22/07 | NA | Guatemala | GT | Guatemala | 994938 | Guatemala City | 2.79113 | 14.6229 | -90.5316 | (14.6229, -90.531599999999997) | Landslide | Mudslide | Medium | Rain | NA | 3 | Fox News | http://www.foxnews.com/story/0,2933,297714,00.html | |||
| 104 | 563 | 6/1/08 | NA | Guatemala | GT | Escuintla | 31329 | Palín | 3.10150 | 14.4226 | -90.6755 | (14.422599999999999, -90.6755) | Landslide | Mudslide | Medium | Tropical cyclone | Tropical Storm Arthur | NA | 1 | http://209.85.215.104/search?q=cache:QU_lPxNfk78J:www.plenglish.com/article.asp?ID=%7B1D4A74F7-CDCA-49D0-ABD4-D2E0FD9D2130%7D&language=EN+Colom+said+the+declaration+came+after+a+death+in+Palin+and+40+houses+partially&hl=en&ct=clnk&cd=1&gl=us&c | |||
| 108 | 591 | 6/18/08 | NA | Guatemala | GT | Guatemala | 994938 | Guatemala City | 3.12614 | 14.6510 | -90.5403 | (14.651, -90.540300000000002) | Landslide | Complex | Medium | Rain | NA | 8 | http://cnnwire.blogs.cnn.com/2008/06/20/8-dead-in-rough-weather-in-guatemala/ |
stem(df_gu$"Distance")
##
## The decimal point is at the |
##
## 0 | 0022445567788888999900456677889
## 2 | 011334677880011233556899
## 4 | 00125713599
## 6 | 012204
## 8 | 39
## 10 |
## 12 | 64
## 14 |
## 16 |
## 18 |
## 20 | 8
## 22 | 69
stem(df_gu$"Distance", scale = 2)
##
## The decimal point is at the |
##
## 0 | 0022445567788888999900456677889
## 2 | 011334677880011233556899
## 4 | 00125713599
## 6 | 012204
## 8 | 39
## 10 |
## 12 | 64
## 14 |
## 16 |
## 18 |
## 20 | 8
## 22 | 69
library(forecast)
data<- ts(df_gu$Distance, frequency=12, start=2008)
knitr::kable(head(data))
| x |
|---|
| 4.74385 |
| 13.39817 |
| 12.55184 |
| 2.79113 |
| 3.10150 |
| 3.12614 |
autoplot(data) + labs(title = "Gráfico de series temporales", x="date", y = "distancia", colour = "green") +theme_bw()
library(questionr)
table <- questionr::freq(Distance, cum = TRUE, sort = "dec", total = TRUE)
knitr::kable(table)
| n | % | val% | %cum | val%cum | |
|---|---|---|---|---|---|
| 0.00359 | 1 | 1.3 | 1.3 | 1.3 | 1.3 |
| 0.0328 | 1 | 1.3 | 1.3 | 2.5 | 2.5 |
| 0.17513 | 1 | 1.3 | 1.3 | 3.8 | 3.8 |
| 0.18542 | 1 | 1.3 | 1.3 | 5.1 | 5.1 |
| 0.35171 | 1 | 1.3 | 1.3 | 6.3 | 6.3 |
| 0.44764 | 1 | 1.3 | 1.3 | 7.6 | 7.6 |
| 0.45507 | 1 | 1.3 | 1.3 | 8.9 | 8.9 |
| 0.50611 | 1 | 1.3 | 1.3 | 10.1 | 10.1 |
| 0.63089 | 1 | 1.3 | 1.3 | 11.4 | 11.4 |
| 0.65744 | 1 | 1.3 | 1.3 | 12.7 | 12.7 |
| 0.6704 | 1 | 1.3 | 1.3 | 13.9 | 13.9 |
| 0.75685 | 1 | 1.3 | 1.3 | 15.2 | 15.2 |
| 0.75729 | 1 | 1.3 | 1.3 | 16.5 | 16.5 |
| 0.77254 | 1 | 1.3 | 1.3 | 17.7 | 17.7 |
| 0.8064 | 1 | 1.3 | 1.3 | 19.0 | 19.0 |
| 0.82332 | 1 | 1.3 | 1.3 | 20.3 | 20.3 |
| 0.8904 | 1 | 1.3 | 1.3 | 21.5 | 21.5 |
| 0.91108 | 1 | 1.3 | 1.3 | 22.8 | 22.8 |
| 0.92729 | 1 | 1.3 | 1.3 | 24.1 | 24.1 |
| 0.94245 | 1 | 1.3 | 1.3 | 25.3 | 25.3 |
| 0.96647 | 1 | 1.3 | 1.3 | 26.6 | 26.6 |
| 0.99952 | 1 | 1.3 | 1.3 | 27.8 | 27.8 |
| 1.36473 | 1 | 1.3 | 1.3 | 29.1 | 29.1 |
| 1.452 | 1 | 1.3 | 1.3 | 30.4 | 30.4 |
| 1.57381 | 1 | 1.3 | 1.3 | 31.6 | 31.6 |
| 1.58358 | 1 | 1.3 | 1.3 | 32.9 | 32.9 |
| 1.6829 | 1 | 1.3 | 1.3 | 34.2 | 34.2 |
| 1.70147 | 1 | 1.3 | 1.3 | 35.4 | 35.4 |
| 1.81216 | 1 | 1.3 | 1.3 | 36.7 | 36.7 |
| 1.83863 | 1 | 1.3 | 1.3 | 38.0 | 38.0 |
| 1.87009 | 1 | 1.3 | 1.3 | 39.2 | 39.2 |
| 2.02891 | 1 | 1.3 | 1.3 | 40.5 | 40.5 |
| 2.08425 | 1 | 1.3 | 1.3 | 41.8 | 41.8 |
| 2.10418 | 1 | 1.3 | 1.3 | 43.0 | 43.0 |
| 2.27725 | 1 | 1.3 | 1.3 | 44.3 | 44.3 |
| 2.30104 | 1 | 1.3 | 1.3 | 45.6 | 45.6 |
| 2.36376 | 1 | 1.3 | 1.3 | 46.8 | 46.8 |
| 2.5962 | 1 | 1.3 | 1.3 | 48.1 | 48.1 |
| 2.66358 | 1 | 1.3 | 1.3 | 49.4 | 49.4 |
| 2.70053 | 1 | 1.3 | 1.3 | 50.6 | 50.6 |
| 2.79113 | 1 | 1.3 | 1.3 | 51.9 | 51.9 |
| 2.81128 | 1 | 1.3 | 1.3 | 53.2 | 53.2 |
| 3.00314 | 1 | 1.3 | 1.3 | 54.4 | 54.4 |
| 3.04642 | 1 | 1.3 | 1.3 | 55.7 | 55.7 |
| 3.1015 | 1 | 1.3 | 1.3 | 57.0 | 57.0 |
| 3.12614 | 1 | 1.3 | 1.3 | 58.2 | 58.2 |
| 3.18658 | 1 | 1.3 | 1.3 | 59.5 | 59.5 |
| 3.25675 | 1 | 1.3 | 1.3 | 60.8 | 60.8 |
| 3.30989 | 1 | 1.3 | 1.3 | 62.0 | 62.0 |
| 3.47803 | 1 | 1.3 | 1.3 | 63.3 | 63.3 |
| 3.49341 | 1 | 1.3 | 1.3 | 64.6 | 64.6 |
| 3.64749 | 1 | 1.3 | 1.3 | 65.8 | 65.8 |
| 3.80312 | 1 | 1.3 | 1.3 | 67.1 | 67.1 |
| 3.85648 | 1 | 1.3 | 1.3 | 68.4 | 68.4 |
| 3.85753 | 1 | 1.3 | 1.3 | 69.6 | 69.6 |
| 3.96161 | 1 | 1.3 | 1.3 | 70.9 | 70.9 |
| 3.98185 | 1 | 1.3 | 1.3 | 72.2 | 72.2 |
| 4.0793 | 1 | 1.3 | 1.3 | 73.4 | 73.4 |
| 4.20726 | 1 | 1.3 | 1.3 | 74.7 | 74.7 |
| 4.51954 | 1 | 1.3 | 1.3 | 75.9 | 75.9 |
| 4.74385 | 1 | 1.3 | 1.3 | 77.2 | 77.2 |
| 5.14479 | 1 | 1.3 | 1.3 | 78.5 | 78.5 |
| 5.31511 | 1 | 1.3 | 1.3 | 79.7 | 79.7 |
| 5.52205 | 1 | 1.3 | 1.3 | 81.0 | 81.0 |
| 5.88787 | 1 | 1.3 | 1.3 | 82.3 | 82.3 |
| 5.94535 | 1 | 1.3 | 1.3 | 83.5 | 83.5 |
| 6.00513 | 1 | 1.3 | 1.3 | 84.8 | 84.8 |
| 6.13527 | 1 | 1.3 | 1.3 | 86.1 | 86.1 |
| 6.15103 | 1 | 1.3 | 1.3 | 87.3 | 87.3 |
| 6.19218 | 1 | 1.3 | 1.3 | 88.6 | 88.6 |
| 7.03115 | 1 | 1.3 | 1.3 | 89.9 | 89.9 |
| 7.39906 | 1 | 1.3 | 1.3 | 91.1 | 91.1 |
| 8.25465 | 1 | 1.3 | 1.3 | 92.4 | 92.4 |
| 8.93658 | 1 | 1.3 | 1.3 | 93.7 | 93.7 |
| 12.55184 | 1 | 1.3 | 1.3 | 94.9 | 94.9 |
| 13.39817 | 1 | 1.3 | 1.3 | 96.2 | 96.2 |
| 21.83272 | 1 | 1.3 | 1.3 | 97.5 | 97.5 |
| 22.56101 | 1 | 1.3 | 1.3 | 98.7 | 98.7 |
| 23.92309 | 1 | 1.3 | 1.3 | 100.0 | 100.0 |
| Total | 79 | 100.0 | 100.0 | 100.0 | 100.0 |
str(table)
## Classes 'freqtab' and 'data.frame': 80 obs. of 5 variables:
## $ n : num 1 1 1 1 1 1 1 1 1 1 ...
## $ % : num 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 ...
## $ val% : num 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 ...
## $ %cum : num 1.3 2.5 3.8 5.1 6.3 7.6 8.9 10.1 11.4 12.7 ...
## $ val%cum: num 1.3 2.5 3.8 5.1 6.3 7.6 8.9 10.1 11.4 12.7 ...
x <- row.names(table)
y <- table$n
names <- x[1:(length(x)-1)]
freqs <- y[1:(length(y)-1)]
df_gu <- data.frame(x = names, y = freqs)
knitr::kable(df_gu)
| x | y |
|---|---|
| 0.00359 | 1 |
| 0.0328 | 1 |
| 0.17513 | 1 |
| 0.18542 | 1 |
| 0.35171 | 1 |
| 0.44764 | 1 |
| 0.45507 | 1 |
| 0.50611 | 1 |
| 0.63089 | 1 |
| 0.65744 | 1 |
| 0.6704 | 1 |
| 0.75685 | 1 |
| 0.75729 | 1 |
| 0.77254 | 1 |
| 0.8064 | 1 |
| 0.82332 | 1 |
| 0.8904 | 1 |
| 0.91108 | 1 |
| 0.92729 | 1 |
| 0.94245 | 1 |
| 0.96647 | 1 |
| 0.99952 | 1 |
| 1.36473 | 1 |
| 1.452 | 1 |
| 1.57381 | 1 |
| 1.58358 | 1 |
| 1.6829 | 1 |
| 1.70147 | 1 |
| 1.81216 | 1 |
| 1.83863 | 1 |
| 1.87009 | 1 |
| 2.02891 | 1 |
| 2.08425 | 1 |
| 2.10418 | 1 |
| 2.27725 | 1 |
| 2.30104 | 1 |
| 2.36376 | 1 |
| 2.5962 | 1 |
| 2.66358 | 1 |
| 2.70053 | 1 |
| 2.79113 | 1 |
| 2.81128 | 1 |
| 3.00314 | 1 |
| 3.04642 | 1 |
| 3.1015 | 1 |
| 3.12614 | 1 |
| 3.18658 | 1 |
| 3.25675 | 1 |
| 3.30989 | 1 |
| 3.47803 | 1 |
| 3.49341 | 1 |
| 3.64749 | 1 |
| 3.80312 | 1 |
| 3.85648 | 1 |
| 3.85753 | 1 |
| 3.96161 | 1 |
| 3.98185 | 1 |
| 4.0793 | 1 |
| 4.20726 | 1 |
| 4.51954 | 1 |
| 4.74385 | 1 |
| 5.14479 | 1 |
| 5.31511 | 1 |
| 5.52205 | 1 |
| 5.88787 | 1 |
| 5.94535 | 1 |
| 6.00513 | 1 |
| 6.13527 | 1 |
| 6.15103 | 1 |
| 6.19218 | 1 |
| 7.03115 | 1 |
| 7.39906 | 1 |
| 8.25465 | 1 |
| 8.93658 | 1 |
| 12.55184 | 1 |
| 13.39817 | 1 |
| 21.83272 | 1 |
| 22.56101 | 1 |
| 23.92309 | 1 |
library(ggplot2)
ggplot(data=df_gu, aes(x=x, y=y)) +
geom_bar(stat="identity", color="white", fill="blue") +
xlab("Rango de deslizamiento") +
ylab("Frecuencia")
n_sturges = 1 + log(length(Distance))/log(2)
n_sturgesc = ceiling(n_sturges)
n_sturgesf = floor(n_sturges)
n_clases = 0
if (n_sturgesc%%2 == 0) {
n_clases = n_sturgesf
} else {
n_clases = n_sturgesc
}
R = max(Distance) - min(Distance)
w = ceiling(R/n_clases)
bins <- seq(min(Distance), max(Distance) + w, by = w)
bins
## [1] 0.00359 4.00359 8.00359 12.00359 16.00359 20.00359 24.00359
Edades <- cut(Distance, bins)
Freq_table <- transform(table(Distance), Rel_Freq=prop.table(Freq), Cum_Freq=cumsum(Freq))
knitr::kable(Freq_table)
| Distance | Freq | Rel_Freq | Cum_Freq |
|---|---|---|---|
| 0.00359 | 1 | 0.0126582 | 1 |
| 0.0328 | 1 | 0.0126582 | 2 |
| 0.17513 | 1 | 0.0126582 | 3 |
| 0.18542 | 1 | 0.0126582 | 4 |
| 0.35171 | 1 | 0.0126582 | 5 |
| 0.44764 | 1 | 0.0126582 | 6 |
| 0.45507 | 1 | 0.0126582 | 7 |
| 0.50611 | 1 | 0.0126582 | 8 |
| 0.63089 | 1 | 0.0126582 | 9 |
| 0.65744 | 1 | 0.0126582 | 10 |
| 0.6704 | 1 | 0.0126582 | 11 |
| 0.75685 | 1 | 0.0126582 | 12 |
| 0.75729 | 1 | 0.0126582 | 13 |
| 0.77254 | 1 | 0.0126582 | 14 |
| 0.8064 | 1 | 0.0126582 | 15 |
| 0.82332 | 1 | 0.0126582 | 16 |
| 0.8904 | 1 | 0.0126582 | 17 |
| 0.91108 | 1 | 0.0126582 | 18 |
| 0.92729 | 1 | 0.0126582 | 19 |
| 0.94245 | 1 | 0.0126582 | 20 |
| 0.96647 | 1 | 0.0126582 | 21 |
| 0.99952 | 1 | 0.0126582 | 22 |
| 1.36473 | 1 | 0.0126582 | 23 |
| 1.452 | 1 | 0.0126582 | 24 |
| 1.57381 | 1 | 0.0126582 | 25 |
| 1.58358 | 1 | 0.0126582 | 26 |
| 1.6829 | 1 | 0.0126582 | 27 |
| 1.70147 | 1 | 0.0126582 | 28 |
| 1.81216 | 1 | 0.0126582 | 29 |
| 1.83863 | 1 | 0.0126582 | 30 |
| 1.87009 | 1 | 0.0126582 | 31 |
| 2.02891 | 1 | 0.0126582 | 32 |
| 2.08425 | 1 | 0.0126582 | 33 |
| 2.10418 | 1 | 0.0126582 | 34 |
| 2.27725 | 1 | 0.0126582 | 35 |
| 2.30104 | 1 | 0.0126582 | 36 |
| 2.36376 | 1 | 0.0126582 | 37 |
| 2.5962 | 1 | 0.0126582 | 38 |
| 2.66358 | 1 | 0.0126582 | 39 |
| 2.70053 | 1 | 0.0126582 | 40 |
| 2.79113 | 1 | 0.0126582 | 41 |
| 2.81128 | 1 | 0.0126582 | 42 |
| 3.00314 | 1 | 0.0126582 | 43 |
| 3.04642 | 1 | 0.0126582 | 44 |
| 3.1015 | 1 | 0.0126582 | 45 |
| 3.12614 | 1 | 0.0126582 | 46 |
| 3.18658 | 1 | 0.0126582 | 47 |
| 3.25675 | 1 | 0.0126582 | 48 |
| 3.30989 | 1 | 0.0126582 | 49 |
| 3.47803 | 1 | 0.0126582 | 50 |
| 3.49341 | 1 | 0.0126582 | 51 |
| 3.64749 | 1 | 0.0126582 | 52 |
| 3.80312 | 1 | 0.0126582 | 53 |
| 3.85648 | 1 | 0.0126582 | 54 |
| 3.85753 | 1 | 0.0126582 | 55 |
| 3.96161 | 1 | 0.0126582 | 56 |
| 3.98185 | 1 | 0.0126582 | 57 |
| 4.0793 | 1 | 0.0126582 | 58 |
| 4.20726 | 1 | 0.0126582 | 59 |
| 4.51954 | 1 | 0.0126582 | 60 |
| 4.74385 | 1 | 0.0126582 | 61 |
| 5.14479 | 1 | 0.0126582 | 62 |
| 5.31511 | 1 | 0.0126582 | 63 |
| 5.52205 | 1 | 0.0126582 | 64 |
| 5.88787 | 1 | 0.0126582 | 65 |
| 5.94535 | 1 | 0.0126582 | 66 |
| 6.00513 | 1 | 0.0126582 | 67 |
| 6.13527 | 1 | 0.0126582 | 68 |
| 6.15103 | 1 | 0.0126582 | 69 |
| 6.19218 | 1 | 0.0126582 | 70 |
| 7.03115 | 1 | 0.0126582 | 71 |
| 7.39906 | 1 | 0.0126582 | 72 |
| 8.25465 | 1 | 0.0126582 | 73 |
| 8.93658 | 1 | 0.0126582 | 74 |
| 12.55184 | 1 | 0.0126582 | 75 |
| 13.39817 | 1 | 0.0126582 | 76 |
| 21.83272 | 1 | 0.0126582 | 77 |
| 22.56101 | 1 | 0.0126582 | 78 |
| 23.92309 | 1 | 0.0126582 | 79 |
str(Freq_table)
## 'data.frame': 79 obs. of 4 variables:
## $ Distance: Factor w/ 79 levels "0.00359","0.0328",..: 1 2 3 4 5 6 7 8 9 10 ...
## $ Freq : int 1 1 1 1 1 1 1 1 1 1 ...
## $ Rel_Freq: num 0.0127 0.0127 0.0127 0.0127 0.0127 ...
## $ Cum_Freq: int 1 2 3 4 5 6 7 8 9 10 ...
df_gu <- data.frame(x = Freq_table$Distance, y = Freq_table$Freq)
knitr::kable(df_gu)
| x | y |
|---|---|
| 0.00359 | 1 |
| 0.0328 | 1 |
| 0.17513 | 1 |
| 0.18542 | 1 |
| 0.35171 | 1 |
| 0.44764 | 1 |
| 0.45507 | 1 |
| 0.50611 | 1 |
| 0.63089 | 1 |
| 0.65744 | 1 |
| 0.6704 | 1 |
| 0.75685 | 1 |
| 0.75729 | 1 |
| 0.77254 | 1 |
| 0.8064 | 1 |
| 0.82332 | 1 |
| 0.8904 | 1 |
| 0.91108 | 1 |
| 0.92729 | 1 |
| 0.94245 | 1 |
| 0.96647 | 1 |
| 0.99952 | 1 |
| 1.36473 | 1 |
| 1.452 | 1 |
| 1.57381 | 1 |
| 1.58358 | 1 |
| 1.6829 | 1 |
| 1.70147 | 1 |
| 1.81216 | 1 |
| 1.83863 | 1 |
| 1.87009 | 1 |
| 2.02891 | 1 |
| 2.08425 | 1 |
| 2.10418 | 1 |
| 2.27725 | 1 |
| 2.30104 | 1 |
| 2.36376 | 1 |
| 2.5962 | 1 |
| 2.66358 | 1 |
| 2.70053 | 1 |
| 2.79113 | 1 |
| 2.81128 | 1 |
| 3.00314 | 1 |
| 3.04642 | 1 |
| 3.1015 | 1 |
| 3.12614 | 1 |
| 3.18658 | 1 |
| 3.25675 | 1 |
| 3.30989 | 1 |
| 3.47803 | 1 |
| 3.49341 | 1 |
| 3.64749 | 1 |
| 3.80312 | 1 |
| 3.85648 | 1 |
| 3.85753 | 1 |
| 3.96161 | 1 |
| 3.98185 | 1 |
| 4.0793 | 1 |
| 4.20726 | 1 |
| 4.51954 | 1 |
| 4.74385 | 1 |
| 5.14479 | 1 |
| 5.31511 | 1 |
| 5.52205 | 1 |
| 5.88787 | 1 |
| 5.94535 | 1 |
| 6.00513 | 1 |
| 6.13527 | 1 |
| 6.15103 | 1 |
| 6.19218 | 1 |
| 7.03115 | 1 |
| 7.39906 | 1 |
| 8.25465 | 1 |
| 8.93658 | 1 |
| 12.55184 | 1 |
| 13.39817 | 1 |
| 21.83272 | 1 |
| 22.56101 | 1 |
| 23.92309 | 1 |
library(ggplot2)
ggplot(data=df_gu, aes(x=x, y=y)) +
geom_bar(stat="identity", color="blue", fill="green") +
xlab("Rango de Distance") +
ylab("Frecuencia")
Estos se encargan de la toma de datos cuantitativa con respecto a la información proporcionada, los datos se calculan a partir de la media, mediana, moda, cuartiles etc.
summary(df_gu$Distance)
## Length Class Mode
## 0 NULL NULL
library(pastecs)
stat.desc(df_gu)
## x y
## nbr.val NA 79
## nbr.null NA 0
## nbr.na NA 0
## min NA 1
## max NA 1
## range NA 0
## sum NA 79
## median NA 1
## mean NA 1
## SE.mean NA 0
## CI.mean NA 0
## var NA 0
## std.dev NA 0
## coef.var NA 0
boxplot(Distance, horizontal=TRUE, col='steelblue')
library(readr)
library(knitr)
df_ho <- subset (df, Country == "Honduras")
knitr::kable(head(df_ho))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 159 | 854 | 10/19/08 | NA | Honduras | HN | Copán | 4752 | Corquín | 0.43391 | 14.5637 | -88.8693 | (14.563700000000001, -88.869299999999996) | Landslide | Landslide | Large | Tropical cyclone | Tropical Depression 16 | NA | 23 | http://www.chron.com/disp/story.mpl/ap/world/6068144.html | |||
| 160 | 855 | 10/20/08 | NA | Honduras | HN | Francisco Morazán | 850848 | Tegucigalpa | 2.99239 | 14.1080 | -87.2137 | (14.108000000000001, -87.213700000000003) | Landslide | Mudslide | Large | Tropical cyclone | Tropical Depression 16 | NA | 29 | http://in.ibtimes.com/articles/20081021/honduras-landslide-tegucigalpa-victim.htm | |||
| 376 | 2062 | 7/12/10 | 5:30:00 | NA | Honduras | HN | Francisco Morazán | 850848 | Tegucigalpa | 0.98377 | 14.0831 | -87.1978 | (14.0831, -87.197800000000001) | Landslide | Mudslide | Medium | Downpour | NA | 1 | http://mdn.mainichi.jp/mdnnews/news/20100713p2a00m0na013000c.html | |||
| 381 | 2093 | 7/18/10 | NA | Honduras | HN | Francisco Morazán | 850848 | Tegucigalpa | 1.24404 | 14.0814 | -87.1953 | (14.0814, -87.195300000000003) | Landslide | Landslide | Medium | Downpour | NA | 0 | http://www.insidecostarica.com/dailynews/2010/july/19/centralamerica10071903.htm | ||||
| 406 | 2217 | 8/7/10 | Overnight | NA | Honduras | HN | Francisco Morazán | 850848 | Tegucigalpa | 2.21442 | 14.0783 | -87.2270 | (14.0783, -87.227000000000004) | Landslide | Mudslide | Medium | Downpour | NA | 3 | ||||
| 435 | 2358 | 8/29/10 | 4:30:00 | NA | Honduras | HN | Francisco Morazán | 2288 | Santa Lucía | 4.75791 | 14.1015 | -87.1607 | (14.1015, -87.160700000000006) | Landslide | Rockfall | Medium | Downpour | NA | 5 |
df_ho %>%
select(Country, State, City, Distance)
## Country State City Distance
## 159 Honduras Copán Corquín 0.43391
## 160 Honduras Francisco Morazán Tegucigalpa 2.99239
## 376 Honduras Francisco Morazán Tegucigalpa 0.98377
## 381 Honduras Francisco Morazán Tegucigalpa 1.24404
## 406 Honduras Francisco Morazán Tegucigalpa 2.21442
## 435 Honduras Francisco Morazán Santa Lucía 4.75791
## 474 Honduras Comayagua El Rancho 4.53362
## 485 Honduras Colón Cusuna 36.37629
## 820 Honduras Francisco Morazán Tegucigalpa 1.23639
## 1100 Honduras Cortés Los Caminos 3.53737
## 1279 Honduras Choluteca Ciudad Choluteca 3.69596
## 1288 Honduras Yoro Yoro 0.31238
## 1363 Honduras Ocotepeque Sinuapa 2.00805
## 1377 Honduras Cortés Agua Azul Rancho 0.97057
## 1379 Honduras Santa Bárbara Agualote 2.91594
## 1599 Honduras El Paraíso 1.90052
## 1602 Honduras Francisco Morazán El Lolo 1.85897
## 1603 Honduras Francisco Morazán Tegucigalpa 3.25281
## 1604 Honduras Choluteca Duyure 11.67237
## 1605 Honduras Choluteca Corpus 0.36987
## 1610 Honduras Comayagua El Sauce 7.28575
## 1611 Honduras Comayagua La Libertad 17.28613
## 1612 Honduras Comayagua Concepción de Guasistagua 8.52584
## 1613 Honduras Copán Santa Rosa de Copán 0.74414
## 1614 Honduras Copán Santa Rosa de Copán 0.28887
## 1615 Honduras Copán Ojos de Agua 1.39095
## 1616 Honduras La Paz San José 4.69133
## 1617 Honduras Copán Lucerna 5.89721
## 1618 Honduras Ocotepeque La Labor 5.79867
## 1619 Honduras Francisco Morazán Villa Nueva 2.00830
## 1620 Honduras Santa Bárbara Ilama 2.87349
## 1622 Honduras Francisco Morazán El Guapinol 3.54399
## 1623 Honduras Yoro La Sarrosa 6.66574
## 1624 Honduras Francisco Morazán El Tablón 3.12986
## 1638 Honduras Francisco Morazán Tegucigalpa 0.91552
## 1639 Honduras Francisco Morazán Yaguacire 1.30583
## 1640 Honduras Francisco Morazán Río Abajo 3.63962
## 1641 Honduras Francisco Morazán Tegucigalpa 2.91326
library(ggplot2)
ggplot(data=df_ho, aes(x= State , y= Distance)) + geom_bar(stat="identity", color="black", fill="purple")
library(ggplot2)
library(dplyr)
ggplot(data=df_ho, aes(fill=City, x="Honduras", y=Distance)) +
geom_bar(position="dodge", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_ho, aes(fill=City, x="Honduras", y=Distance)) +
geom_bar(position="stack", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_ho, aes(x = "Honduras", y = Distance , fill=City)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y", start = 0)
library(qcc)
Distance <- df_ho$Distance
names(Distance) <- df_ho$City
pareto.chart(Distance,
ylab="Distance",
col = heat.colors(length(Distance)),
cumperc = seq(0, 100, by = 10),
ylab2 = "Porcentaje acumulado",
main = "DONDE SE CONCENTRAN LAS CIUDADES CON MAYORES DESLIZAMIENTOS")
##
## Pareto chart analysis for Distance
## Frequency Cum.Freq. Percentage Cum.Percent.
## Cusuna 36.3762900 36.3762900 21.8907391 21.8907391
## La Libertad 17.2861300 53.6624200 10.4025496 32.2932888
## Duyure 11.6723700 65.3347900 7.0242679 39.3175567
## Concepción de Guasistagua 8.5258400 73.8606300 5.1307305 44.4482872
## El Sauce 7.2857500 81.1463800 4.3844618 48.8327489
## La Sarrosa 6.6657400 87.8121200 4.0113485 52.8440974
## Lucerna 5.8972100 93.7093300 3.5488579 56.3929554
## La Labor 5.7986700 99.5080000 3.4895580 59.8825133
## Santa Lucía 4.7579100 104.2659100 2.8632432 62.7457566
## San José 4.6913300 108.9572400 2.8231763 65.5689329
## El Rancho 4.5336200 113.4908600 2.7282687 68.2972016
## Ciudad Choluteca 3.6959600 117.1868200 2.2241767 70.5213783
## Río Abajo 3.6396200 120.8264400 2.1902721 72.7116504
## El Guapinol 3.5439900 124.3704300 2.1327233 74.8443736
## Los Caminos 3.5373700 127.9078000 2.1287395 76.9731131
## Tegucigalpa 3.2528100 131.1606100 1.9574953 78.9306084
## El Tablón 3.1298600 134.2904700 1.8835057 80.8141140
## Tegucigalpa 2.9923900 137.2828600 1.8007782 82.6148922
## Agualote 2.9159400 140.1988000 1.7547716 84.3696639
## Tegucigalpa 2.9132600 143.1120600 1.7531588 86.1228227
## Ilama 2.8734900 145.9855500 1.7292258 87.8520485
## Tegucigalpa 2.2144200 148.1999700 1.3326068 89.1846553
## Villa Nueva 2.0083000 150.2082700 1.2085667 90.3932220
## Sinuapa 2.0080500 152.2163200 1.2084162 91.6016382
## 1.9005200 154.1168400 1.1437062 92.7453444
## El Lolo 1.8589700 155.9758100 1.1187020 93.8640463
## Ojos de Agua 1.3909500 157.3667600 0.8370541 94.7011005
## Yaguacire 1.3058300 158.6725900 0.7858301 95.4869306
## Tegucigalpa 1.2440400 159.9166300 0.7486458 96.2355763
## Tegucigalpa 1.2363900 161.1530200 0.7440421 96.9796184
## Tegucigalpa 0.9837700 162.1367900 0.5920189 97.5716373
## Agua Azul Rancho 0.9705700 163.1073600 0.5840754 98.1557127
## Tegucigalpa 0.9155200 164.0228800 0.5509470 98.7066598
## Santa Rosa de Copán 0.7441400 164.7670200 0.4478130 99.1544727
## Corquín 0.4339100 165.2009300 0.2611209 99.4155937
## Corpus 0.3698700 165.5708000 0.2225826 99.6381762
## Yoro 0.3123800 165.8831800 0.1879859 99.8261621
## Santa Rosa de Copán 0.2888700 166.1720500 0.1738379 100.0000000
stem(df_ho$"Distance")
##
## The decimal point is 1 digit(s) to the right of the |
##
## 0 | 000011111111222223333334444
## 0 | 55566779
## 1 | 2
## 1 | 7
## 2 |
## 2 |
## 3 |
## 3 | 6
head(df_ho)
## id date time continent_code Country country_code
## 159 854 10/19/08 <NA> Honduras HN
## 160 855 10/20/08 <NA> Honduras HN
## 376 2062 7/12/10 5:30:00 <NA> Honduras HN
## 381 2093 7/18/10 <NA> Honduras HN
## 406 2217 8/7/10 Overnight <NA> Honduras HN
## 435 2358 8/29/10 4:30:00 <NA> Honduras HN
## State population City Distance location_description
## 159 Copán 4752 Corquín 0.43391
## 160 Francisco Morazán 850848 Tegucigalpa 2.99239
## 376 Francisco Morazán 850848 Tegucigalpa 0.98377
## 381 Francisco Morazán 850848 Tegucigalpa 1.24404
## 406 Francisco Morazán 850848 Tegucigalpa 2.21442
## 435 Francisco Morazán 2288 Santa Lucía 4.75791
## latitude longitude geolocation hazard_type
## 159 14.5637 -88.8693 (14.563700000000001, -88.869299999999996) Landslide
## 160 14.1080 -87.2137 (14.108000000000001, -87.213700000000003) Landslide
## 376 14.0831 -87.1978 (14.0831, -87.197800000000001) Landslide
## 381 14.0814 -87.1953 (14.0814, -87.195300000000003) Landslide
## 406 14.0783 -87.2270 (14.0783, -87.227000000000004) Landslide
## 435 14.1015 -87.1607 (14.1015, -87.160700000000006) Landslide
## landslide_type landslide_size trigger storm_name
## 159 Landslide Large Tropical cyclone Tropical Depression 16
## 160 Mudslide Large Tropical cyclone Tropical Depression 16
## 376 Mudslide Medium Downpour
## 381 Landslide Medium Downpour
## 406 Mudslide Medium Downpour
## 435 Rockfall Medium Downpour
## injuries fatalities source_name
## 159 NA 23
## 160 NA 29
## 376 NA 1
## 381 NA 0
## 406 NA 3
## 435 NA 5
## source_link
## 159 http://www.chron.com/disp/story.mpl/ap/world/6068144.html
## 160 http://in.ibtimes.com/articles/20081021/honduras-landslide-tegucigalpa-victim.htm
## 376 http://mdn.mainichi.jp/mdnnews/news/20100713p2a00m0na013000c.html
## 381 http://www.insidecostarica.com/dailynews/2010/july/19/centralamerica10071903.htm
## 406
## 435
knitr::kable(head(df_ho))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 159 | 854 | 10/19/08 | NA | Honduras | HN | Copán | 4752 | Corquín | 0.43391 | 14.5637 | -88.8693 | (14.563700000000001, -88.869299999999996) | Landslide | Landslide | Large | Tropical cyclone | Tropical Depression 16 | NA | 23 | http://www.chron.com/disp/story.mpl/ap/world/6068144.html | |||
| 160 | 855 | 10/20/08 | NA | Honduras | HN | Francisco Morazán | 850848 | Tegucigalpa | 2.99239 | 14.1080 | -87.2137 | (14.108000000000001, -87.213700000000003) | Landslide | Mudslide | Large | Tropical cyclone | Tropical Depression 16 | NA | 29 | http://in.ibtimes.com/articles/20081021/honduras-landslide-tegucigalpa-victim.htm | |||
| 376 | 2062 | 7/12/10 | 5:30:00 | NA | Honduras | HN | Francisco Morazán | 850848 | Tegucigalpa | 0.98377 | 14.0831 | -87.1978 | (14.0831, -87.197800000000001) | Landslide | Mudslide | Medium | Downpour | NA | 1 | http://mdn.mainichi.jp/mdnnews/news/20100713p2a00m0na013000c.html | |||
| 381 | 2093 | 7/18/10 | NA | Honduras | HN | Francisco Morazán | 850848 | Tegucigalpa | 1.24404 | 14.0814 | -87.1953 | (14.0814, -87.195300000000003) | Landslide | Landslide | Medium | Downpour | NA | 0 | http://www.insidecostarica.com/dailynews/2010/july/19/centralamerica10071903.htm | ||||
| 406 | 2217 | 8/7/10 | Overnight | NA | Honduras | HN | Francisco Morazán | 850848 | Tegucigalpa | 2.21442 | 14.0783 | -87.2270 | (14.0783, -87.227000000000004) | Landslide | Mudslide | Medium | Downpour | NA | 3 | ||||
| 435 | 2358 | 8/29/10 | 4:30:00 | NA | Honduras | HN | Francisco Morazán | 2288 | Santa Lucía | 4.75791 | 14.1015 | -87.1607 | (14.1015, -87.160700000000006) | Landslide | Rockfall | Medium | Downpour | NA | 5 |
stem(df_ho$"Distance")
##
## The decimal point is 1 digit(s) to the right of the |
##
## 0 | 000011111111222223333334444
## 0 | 55566779
## 1 | 2
## 1 | 7
## 2 |
## 2 |
## 3 |
## 3 | 6
stem(df_ho$"Distance", scale = 2)
##
## The decimal point is at the |
##
## 0 | 33447900223499
## 2 | 0029990135567
## 4 | 57889
## 6 | 73
## 8 | 5
## 10 | 7
## 12 |
## 14 |
## 16 | 3
## 18 |
## 20 |
## 22 |
## 24 |
## 26 |
## 28 |
## 30 |
## 32 |
## 34 |
## 36 | 4
library(forecast)
data<- ts(df_ho$Distance, frequency=12, start=2008)
knitr::kable(head(data))
| x |
|---|
| 0.43391 |
| 2.99239 |
| 0.98377 |
| 1.24404 |
| 2.21442 |
| 4.75791 |
autoplot(data) + labs(title = "Gráfico de series temporales", x="date", y = "distancia", colour = "green") +theme_bw()
library(questionr)
table <- questionr::freq(Distance, cum = TRUE, sort = "dec", total = TRUE)
knitr::kable(table)
| n | % | val% | %cum | val%cum | |
|---|---|---|---|---|---|
| 0.28887 | 1 | 2.6 | 2.6 | 2.6 | 2.6 |
| 0.31238 | 1 | 2.6 | 2.6 | 5.3 | 5.3 |
| 0.36987 | 1 | 2.6 | 2.6 | 7.9 | 7.9 |
| 0.43391 | 1 | 2.6 | 2.6 | 10.5 | 10.5 |
| 0.74414 | 1 | 2.6 | 2.6 | 13.2 | 13.2 |
| 0.91552 | 1 | 2.6 | 2.6 | 15.8 | 15.8 |
| 0.97057 | 1 | 2.6 | 2.6 | 18.4 | 18.4 |
| 0.98377 | 1 | 2.6 | 2.6 | 21.1 | 21.1 |
| 1.23639 | 1 | 2.6 | 2.6 | 23.7 | 23.7 |
| 1.24404 | 1 | 2.6 | 2.6 | 26.3 | 26.3 |
| 1.30583 | 1 | 2.6 | 2.6 | 28.9 | 28.9 |
| 1.39095 | 1 | 2.6 | 2.6 | 31.6 | 31.6 |
| 1.85897 | 1 | 2.6 | 2.6 | 34.2 | 34.2 |
| 1.90052 | 1 | 2.6 | 2.6 | 36.8 | 36.8 |
| 2.00805 | 1 | 2.6 | 2.6 | 39.5 | 39.5 |
| 2.0083 | 1 | 2.6 | 2.6 | 42.1 | 42.1 |
| 2.21442 | 1 | 2.6 | 2.6 | 44.7 | 44.7 |
| 2.87349 | 1 | 2.6 | 2.6 | 47.4 | 47.4 |
| 2.91326 | 1 | 2.6 | 2.6 | 50.0 | 50.0 |
| 2.91594 | 1 | 2.6 | 2.6 | 52.6 | 52.6 |
| 2.99239 | 1 | 2.6 | 2.6 | 55.3 | 55.3 |
| 3.12986 | 1 | 2.6 | 2.6 | 57.9 | 57.9 |
| 3.25281 | 1 | 2.6 | 2.6 | 60.5 | 60.5 |
| 3.53737 | 1 | 2.6 | 2.6 | 63.2 | 63.2 |
| 3.54399 | 1 | 2.6 | 2.6 | 65.8 | 65.8 |
| 3.63962 | 1 | 2.6 | 2.6 | 68.4 | 68.4 |
| 3.69596 | 1 | 2.6 | 2.6 | 71.1 | 71.1 |
| 4.53362 | 1 | 2.6 | 2.6 | 73.7 | 73.7 |
| 4.69133 | 1 | 2.6 | 2.6 | 76.3 | 76.3 |
| 4.75791 | 1 | 2.6 | 2.6 | 78.9 | 78.9 |
| 5.79867 | 1 | 2.6 | 2.6 | 81.6 | 81.6 |
| 5.89721 | 1 | 2.6 | 2.6 | 84.2 | 84.2 |
| 6.66574 | 1 | 2.6 | 2.6 | 86.8 | 86.8 |
| 7.28575 | 1 | 2.6 | 2.6 | 89.5 | 89.5 |
| 8.52584 | 1 | 2.6 | 2.6 | 92.1 | 92.1 |
| 11.67237 | 1 | 2.6 | 2.6 | 94.7 | 94.7 |
| 17.28613 | 1 | 2.6 | 2.6 | 97.4 | 97.4 |
| 36.37629 | 1 | 2.6 | 2.6 | 100.0 | 100.0 |
| Total | 38 | 100.0 | 100.0 | 100.0 | 100.0 |
str(table)
## Classes 'freqtab' and 'data.frame': 39 obs. of 5 variables:
## $ n : num 1 1 1 1 1 1 1 1 1 1 ...
## $ % : num 2.6 2.6 2.6 2.6 2.6 2.6 2.6 2.6 2.6 2.6 ...
## $ val% : num 2.6 2.6 2.6 2.6 2.6 2.6 2.6 2.6 2.6 2.6 ...
## $ %cum : num 2.6 5.3 7.9 10.5 13.2 15.8 18.4 21.1 23.7 26.3 ...
## $ val%cum: num 2.6 5.3 7.9 10.5 13.2 15.8 18.4 21.1 23.7 26.3 ...
x <- row.names(table)
y <- table$n
names <- x[1:(length(x)-1)]
freqs <- y[1:(length(y)-1)]
df_ho <- data.frame(x = names, y = freqs)
knitr::kable(df_ho)
| x | y |
|---|---|
| 0.28887 | 1 |
| 0.31238 | 1 |
| 0.36987 | 1 |
| 0.43391 | 1 |
| 0.74414 | 1 |
| 0.91552 | 1 |
| 0.97057 | 1 |
| 0.98377 | 1 |
| 1.23639 | 1 |
| 1.24404 | 1 |
| 1.30583 | 1 |
| 1.39095 | 1 |
| 1.85897 | 1 |
| 1.90052 | 1 |
| 2.00805 | 1 |
| 2.0083 | 1 |
| 2.21442 | 1 |
| 2.87349 | 1 |
| 2.91326 | 1 |
| 2.91594 | 1 |
| 2.99239 | 1 |
| 3.12986 | 1 |
| 3.25281 | 1 |
| 3.53737 | 1 |
| 3.54399 | 1 |
| 3.63962 | 1 |
| 3.69596 | 1 |
| 4.53362 | 1 |
| 4.69133 | 1 |
| 4.75791 | 1 |
| 5.79867 | 1 |
| 5.89721 | 1 |
| 6.66574 | 1 |
| 7.28575 | 1 |
| 8.52584 | 1 |
| 11.67237 | 1 |
| 17.28613 | 1 |
| 36.37629 | 1 |
library(ggplot2)
ggplot(data=df_ho, aes(x=x, y=y)) +
geom_bar(stat="identity", color="white", fill="blue") +
xlab("Rango de deslizamiento") +
ylab("Frecuencia")
n_sturges = 1 + log(length(Distance))/log(2)
n_sturgesc = ceiling(n_sturges)
n_sturgesf = floor(n_sturges)
n_clases = 0
if (n_sturgesc%%2 == 0) {
n_clases = n_sturgesf
} else {
n_clases = n_sturgesc
}
R = max(Distance) - min(Distance)
w = ceiling(R/n_clases)
bins <- seq(min(Distance), max(Distance) + w, by = w)
bins
## [1] 0.28887 6.28887 12.28887 18.28887 24.28887 30.28887 36.28887 42.28887
Edades <- cut(Distance, bins)
Freq_table <- transform(table(Distance), Rel_Freq=prop.table(Freq), Cum_Freq=cumsum(Freq))
knitr::kable(Freq_table)
| Distance | Freq | Rel_Freq | Cum_Freq |
|---|---|---|---|
| 0.28887 | 1 | 0.0263158 | 1 |
| 0.31238 | 1 | 0.0263158 | 2 |
| 0.36987 | 1 | 0.0263158 | 3 |
| 0.43391 | 1 | 0.0263158 | 4 |
| 0.74414 | 1 | 0.0263158 | 5 |
| 0.91552 | 1 | 0.0263158 | 6 |
| 0.97057 | 1 | 0.0263158 | 7 |
| 0.98377 | 1 | 0.0263158 | 8 |
| 1.23639 | 1 | 0.0263158 | 9 |
| 1.24404 | 1 | 0.0263158 | 10 |
| 1.30583 | 1 | 0.0263158 | 11 |
| 1.39095 | 1 | 0.0263158 | 12 |
| 1.85897 | 1 | 0.0263158 | 13 |
| 1.90052 | 1 | 0.0263158 | 14 |
| 2.00805 | 1 | 0.0263158 | 15 |
| 2.0083 | 1 | 0.0263158 | 16 |
| 2.21442 | 1 | 0.0263158 | 17 |
| 2.87349 | 1 | 0.0263158 | 18 |
| 2.91326 | 1 | 0.0263158 | 19 |
| 2.91594 | 1 | 0.0263158 | 20 |
| 2.99239 | 1 | 0.0263158 | 21 |
| 3.12986 | 1 | 0.0263158 | 22 |
| 3.25281 | 1 | 0.0263158 | 23 |
| 3.53737 | 1 | 0.0263158 | 24 |
| 3.54399 | 1 | 0.0263158 | 25 |
| 3.63962 | 1 | 0.0263158 | 26 |
| 3.69596 | 1 | 0.0263158 | 27 |
| 4.53362 | 1 | 0.0263158 | 28 |
| 4.69133 | 1 | 0.0263158 | 29 |
| 4.75791 | 1 | 0.0263158 | 30 |
| 5.79867 | 1 | 0.0263158 | 31 |
| 5.89721 | 1 | 0.0263158 | 32 |
| 6.66574 | 1 | 0.0263158 | 33 |
| 7.28575 | 1 | 0.0263158 | 34 |
| 8.52584 | 1 | 0.0263158 | 35 |
| 11.67237 | 1 | 0.0263158 | 36 |
| 17.28613 | 1 | 0.0263158 | 37 |
| 36.37629 | 1 | 0.0263158 | 38 |
str(Freq_table)
## 'data.frame': 38 obs. of 4 variables:
## $ Distance: Factor w/ 38 levels "0.28887","0.31238",..: 1 2 3 4 5 6 7 8 9 10 ...
## $ Freq : int 1 1 1 1 1 1 1 1 1 1 ...
## $ Rel_Freq: num 0.0263 0.0263 0.0263 0.0263 0.0263 ...
## $ Cum_Freq: int 1 2 3 4 5 6 7 8 9 10 ...
df_ho <- data.frame(x = Freq_table$Distance, y = Freq_table$Freq)
knitr::kable(df_ho)
| x | y |
|---|---|
| 0.28887 | 1 |
| 0.31238 | 1 |
| 0.36987 | 1 |
| 0.43391 | 1 |
| 0.74414 | 1 |
| 0.91552 | 1 |
| 0.97057 | 1 |
| 0.98377 | 1 |
| 1.23639 | 1 |
| 1.24404 | 1 |
| 1.30583 | 1 |
| 1.39095 | 1 |
| 1.85897 | 1 |
| 1.90052 | 1 |
| 2.00805 | 1 |
| 2.0083 | 1 |
| 2.21442 | 1 |
| 2.87349 | 1 |
| 2.91326 | 1 |
| 2.91594 | 1 |
| 2.99239 | 1 |
| 3.12986 | 1 |
| 3.25281 | 1 |
| 3.53737 | 1 |
| 3.54399 | 1 |
| 3.63962 | 1 |
| 3.69596 | 1 |
| 4.53362 | 1 |
| 4.69133 | 1 |
| 4.75791 | 1 |
| 5.79867 | 1 |
| 5.89721 | 1 |
| 6.66574 | 1 |
| 7.28575 | 1 |
| 8.52584 | 1 |
| 11.67237 | 1 |
| 17.28613 | 1 |
| 36.37629 | 1 |
library(ggplot2)
ggplot(data=df_ho, aes(x=x, y=y)) +
geom_bar(stat="identity", color="blue", fill="green") +
xlab("Rango de Distance") +
ylab("Frecuencia")
Estos se encargan de la toma de datos cuantitativa con respecto a la información proporcionada, los datos se calculan a partir de la media, mediana, moda, cuartiles etc.
summary(df_ho$Distance)
## Length Class Mode
## 0 NULL NULL
library(pastecs)
stat.desc(df_ho)
## x y
## nbr.val NA 38
## nbr.null NA 0
## nbr.na NA 0
## min NA 1
## max NA 1
## range NA 0
## sum NA 38
## median NA 1
## mean NA 1
## SE.mean NA 0
## CI.mean NA 0
## var NA 0
## std.dev NA 0
## coef.var NA 0
boxplot(Distance, horizontal=TRUE, col='steelblue')
library(readr)
library(knitr)
df_ni <- subset (df, Country == "Nicaragua")
knitr::kable(head(df_ni))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 33 | 229 | 9/4/07 | NA | Nicaragua | NI | Atlántico Norte | 6315 | Bonanza | 54.90196 | 13.6670 | -84.2435 | (13.667, -84.243499999999997) | Landslide | Complex | Medium | Tropical cyclone | Hurricane Felix | NA | NA | United Nations Development Programme - Relief Web | http://www.reliefweb.int/ | ||
| 151 | 826 | 10/3/08 | NA | Nicaragua | NI | Masaya | 5182 | Tisma | 14.49301 | 12.1200 | -85.8900 | (12.12, -85.89) | Landslide | Landslide | Medium | Downpour | NA | 9 | CBC | http://www.cbc.ca/world/story/2008/10/04/nicaragua-flooding.html | |||
| 420 | 2289 | 8/20/10 | NA | Nicaragua | NI | Managua | 16469 | El Crucero | 5.84054 | 12.0420 | -86.2998 | (12.042, -86.299800000000005) | Landslide | Mudslide | Medium | Downpour | NA | 3 | |||||
| 424 | 2330 | 8/25/10 | NA | Nicaragua | NI | Jinotega | 2367 | San José de Bocay | 1.36745 | 13.5317 | -85.5325 | (13.531700000000001, -85.532499999999999) | Landslide | Landslide | Medium | Downpour | NA | NA | |||||
| 1261 | 6089 | 6/23/14 | NA | Nicaragua | NI | Chontales | 5827 | Santo Domingo | 31.14242 | Unknown | 12.3535 | -84.8095 | (12.3535, -84.8095) | Landslide | Landslide | Small | Continuous rain | 0 | 0 | Wilfried Strauch | |||
| 1262 | 6090 | 6/23/14 | NA | Nicaragua | NI | Chontales | 5827 | Santo Domingo | 31.24511 | Unknown | 12.3521 | -84.8080 | (12.3521, -84.808000000000007) | Landslide | Landslide | Medium | Continuous rain | 0 | 0 | Wilfried Strauch |
df_ni %>%
select(Country, State, City, Distance)
## Country State City Distance
## 33 Nicaragua Atlántico Norte Bonanza 54.90196
## 151 Nicaragua Masaya Tisma 14.49301
## 420 Nicaragua Managua El Crucero 5.84054
## 424 Nicaragua Jinotega San José de Bocay 1.36745
## 1261 Nicaragua Chontales Santo Domingo 31.14242
## 1262 Nicaragua Chontales Santo Domingo 31.24511
## 1263 Nicaragua Chontales Santo Domingo 31.37360
## 1264 Nicaragua Chontales Santo Domingo 31.10125
## 1265 Nicaragua Chontales Santo Domingo 30.99704
## 1266 Nicaragua Chontales Santo Domingo 30.77070
## 1267 Nicaragua Chontales Santo Domingo 30.27546
## 1268 Nicaragua Chontales Santo Domingo 29.95253
## 1269 Nicaragua Chontales Santo Domingo 29.92927
## 1270 Nicaragua Chontales Santo Domingo 28.90294
## 1271 Nicaragua Chontales Santo Domingo 32.69694
## 1272 Nicaragua Chontales Santo Domingo 32.96402
## 1273 Nicaragua Chontales Santo Domingo 32.77401
## 1274 Nicaragua Chontales Santo Domingo 29.94574
## 1299 Nicaragua Managua Ciudad Sandino 5.59574
## 1321 Nicaragua Ogun State Bonanza 0.37593
## 1380 Nicaragua Rivas Altagracia 1.97784
## 1381 Nicaragua Rivas Altagracia 5.77119
## 1382 Nicaragua Río San Juan San Carlos 0.67752
## 1626 Nicaragua Jinotega Wiwilí 25.81514
## 1627 Nicaragua Jinotega Jinotega 2.44880
## 1631 Nicaragua Madriz Las Sabanas 7.21108
## 1632 Nicaragua Madriz Las Sabanas 4.86364
## 1633 Nicaragua Managua Terrabona 18.92056
## 1634 Nicaragua Ogun State Bonanza 10.61568
## 1636 Nicaragua Ogun State Siuna 1.68056
## 1637 Nicaragua Masaya San Juan de Oriente 1.56730
library(ggplot2)
ggplot(data=df_ni, aes(x= State , y= Distance)) + geom_bar(stat="identity", color="black", fill="purple")
library(ggplot2)
library(dplyr)
ggplot(data=df_ni, aes(fill=City, x="Nicaragua", y=Distance)) +
geom_bar(position="dodge", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_ni, aes(fill=City, x="Nicaragua", y=Distance)) +
geom_bar(position="stack", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_ni, aes(x = "Nicaragua", y = Distance , fill=City)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y", start = 0)
library(qcc)
Distance <- df_ni$Distance
names(Distance) <- df_ni$City
pareto.chart(Distance,
ylab="Distance",
col = heat.colors(length(Distance)),
cumperc = seq(0, 100, by = 10),
ylab2 = "Porcentaje acumulado",
main = "DONDE SE CONCENTRAN LAS CIUDADES CON MAYORES DESLIZAMIENTOS")
##
## Pareto chart analysis for Distance
## Frequency Cum.Freq. Percentage Cum.Percent.
## Bonanza 54.90196000 54.90196000 9.17793742 9.17793742
## Santo Domingo 32.96402000 87.86598000 5.51058127 14.68851869
## Santo Domingo 32.77401000 120.63999000 5.47881738 20.16733608
## Santo Domingo 32.69694000 153.33693000 5.46593362 25.63326970
## Santo Domingo 31.37360000 184.71053000 5.24471144 30.87798114
## Santo Domingo 31.24511000 215.95564000 5.22323182 36.10121295
## Santo Domingo 31.14242000 247.09806000 5.20606517 41.30727813
## Santo Domingo 31.10125000 278.19931000 5.19918280 46.50646093
## Santo Domingo 30.99704000 309.19635000 5.18176206 51.68822299
## Santo Domingo 30.77070000 339.96705000 5.14392490 56.83214789
## Santo Domingo 30.27546000 370.24251000 5.06113584 61.89328372
## Santo Domingo 29.95253000 400.19504000 5.00715177 66.90043549
## Santo Domingo 29.94574000 430.14078000 5.00601668 71.90645217
## Santo Domingo 29.92927000 460.07005000 5.00326340 76.90971557
## Santo Domingo 28.90294000 488.97299000 4.83169225 81.74140782
## Wiwilí 25.81514000 514.78813000 4.31550603 86.05691385
## Terrabona 18.92056000 533.70869000 3.16294201 89.21985586
## Tisma 14.49301000 548.20170000 2.42279035 91.64264621
## Bonanza 10.61568000 558.81738000 1.77461873 93.41726494
## Las Sabanas 7.21108000 566.02846000 1.20547319 94.62273814
## El Crucero 5.84054000 571.86900000 0.97636060 95.59909874
## Altagracia 5.77119000 577.64019000 0.96476739 96.56386613
## Ciudad Sandino 5.59574000 583.23593000 0.93543749 97.49930361
## Las Sabanas 4.86364000 588.09957000 0.81305264 98.31235625
## Jinotega 2.44880000 590.54837000 0.40936486 98.72172111
## Altagracia 1.97784000 592.52621000 0.33063468 99.05235579
## Siuna 1.68056000 594.20677000 0.28093850 99.33329429
## San Juan de Oriente 1.56730000 595.77407000 0.26200488 99.59529917
## San José de Bocay 1.36745000 597.14152000 0.22859604 99.82389521
## San Carlos 0.67752000 597.81904000 0.11326073 99.93715594
## Bonanza 0.37593000 598.19497000 0.06284406 100.00000000
stem(df_ni$"Distance")
##
## The decimal point is 1 digit(s) to the right of the |
##
## 0 | 011222256667
## 1 | 149
## 2 | 69
## 3 | 0000111111333
## 4 |
## 5 | 5
head(df_ni)
## id date time continent_code Country country_code State
## 33 229 9/4/07 <NA> Nicaragua NI Atlántico Norte
## 151 826 10/3/08 <NA> Nicaragua NI Masaya
## 420 2289 8/20/10 <NA> Nicaragua NI Managua
## 424 2330 8/25/10 <NA> Nicaragua NI Jinotega
## 1261 6089 6/23/14 <NA> Nicaragua NI Chontales
## 1262 6090 6/23/14 <NA> Nicaragua NI Chontales
## population City Distance location_description latitude
## 33 6315 Bonanza 54.90196 13.6670
## 151 5182 Tisma 14.49301 12.1200
## 420 16469 El Crucero 5.84054 12.0420
## 424 2367 San José de Bocay 1.36745 13.5317
## 1261 5827 Santo Domingo 31.14242 Unknown 12.3535
## 1262 5827 Santo Domingo 31.24511 Unknown 12.3521
## longitude geolocation hazard_type
## 33 -84.2435 (13.667, -84.243499999999997) Landslide
## 151 -85.8900 (12.12, -85.89) Landslide
## 420 -86.2998 (12.042, -86.299800000000005) Landslide
## 424 -85.5325 (13.531700000000001, -85.532499999999999) Landslide
## 1261 -84.8095 (12.3535, -84.8095) Landslide
## 1262 -84.8080 (12.3521, -84.808000000000007) Landslide
## landslide_type landslide_size trigger storm_name injuries
## 33 Complex Medium Tropical cyclone Hurricane Felix NA
## 151 Landslide Medium Downpour NA
## 420 Mudslide Medium Downpour NA
## 424 Landslide Medium Downpour NA
## 1261 Landslide Small Continuous rain 0
## 1262 Landslide Medium Continuous rain 0
## fatalities source_name
## 33 NA United Nations Development Programme - Relief Web
## 151 9 CBC
## 420 3
## 424 NA
## 1261 0 Wilfried Strauch
## 1262 0 Wilfried Strauch
## source_link
## 33 http://www.reliefweb.int/
## 151 http://www.cbc.ca/world/story/2008/10/04/nicaragua-flooding.html
## 420
## 424
## 1261
## 1262
knitr::kable(head(df_ni))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 33 | 229 | 9/4/07 | NA | Nicaragua | NI | Atlántico Norte | 6315 | Bonanza | 54.90196 | 13.6670 | -84.2435 | (13.667, -84.243499999999997) | Landslide | Complex | Medium | Tropical cyclone | Hurricane Felix | NA | NA | United Nations Development Programme - Relief Web | http://www.reliefweb.int/ | ||
| 151 | 826 | 10/3/08 | NA | Nicaragua | NI | Masaya | 5182 | Tisma | 14.49301 | 12.1200 | -85.8900 | (12.12, -85.89) | Landslide | Landslide | Medium | Downpour | NA | 9 | CBC | http://www.cbc.ca/world/story/2008/10/04/nicaragua-flooding.html | |||
| 420 | 2289 | 8/20/10 | NA | Nicaragua | NI | Managua | 16469 | El Crucero | 5.84054 | 12.0420 | -86.2998 | (12.042, -86.299800000000005) | Landslide | Mudslide | Medium | Downpour | NA | 3 | |||||
| 424 | 2330 | 8/25/10 | NA | Nicaragua | NI | Jinotega | 2367 | San José de Bocay | 1.36745 | 13.5317 | -85.5325 | (13.531700000000001, -85.532499999999999) | Landslide | Landslide | Medium | Downpour | NA | NA | |||||
| 1261 | 6089 | 6/23/14 | NA | Nicaragua | NI | Chontales | 5827 | Santo Domingo | 31.14242 | Unknown | 12.3535 | -84.8095 | (12.3535, -84.8095) | Landslide | Landslide | Small | Continuous rain | 0 | 0 | Wilfried Strauch | |||
| 1262 | 6090 | 6/23/14 | NA | Nicaragua | NI | Chontales | 5827 | Santo Domingo | 31.24511 | Unknown | 12.3521 | -84.8080 | (12.3521, -84.808000000000007) | Landslide | Landslide | Medium | Continuous rain | 0 | 0 | Wilfried Strauch |
stem(df_ni$"Distance")
##
## The decimal point is 1 digit(s) to the right of the |
##
## 0 | 011222256667
## 1 | 149
## 2 | 69
## 3 | 0000111111333
## 4 |
## 5 | 5
stem(df_ni$"Distance", scale = 2)
##
## The decimal point is 1 digit(s) to the right of the |
##
## 0 | 0112222
## 0 | 56667
## 1 | 14
## 1 | 9
## 2 |
## 2 | 69
## 3 | 0000111111333
## 3 |
## 4 |
## 4 |
## 5 |
## 5 | 5
library(forecast)
data<- ts(df_ni$Distance, frequency=12, start=2008)
knitr::kable(head(data))
| x |
|---|
| 54.90196 |
| 14.49301 |
| 5.84054 |
| 1.36745 |
| 31.14242 |
| 31.24511 |
autoplot(data) + labs(title = "Gráfico de series temporales", x="date", y = "distancia", colour = "green") +theme_bw()
library(questionr)
table <- questionr::freq(Distance, cum = TRUE, sort = "dec", total = TRUE)
knitr::kable(table)
| n | % | val% | %cum | val%cum | |
|---|---|---|---|---|---|
| 0.37593 | 1 | 3.2 | 3.2 | 3.2 | 3.2 |
| 0.67752 | 1 | 3.2 | 3.2 | 6.5 | 6.5 |
| 1.36745 | 1 | 3.2 | 3.2 | 9.7 | 9.7 |
| 1.5673 | 1 | 3.2 | 3.2 | 12.9 | 12.9 |
| 1.68056 | 1 | 3.2 | 3.2 | 16.1 | 16.1 |
| 1.97784 | 1 | 3.2 | 3.2 | 19.4 | 19.4 |
| 2.4488 | 1 | 3.2 | 3.2 | 22.6 | 22.6 |
| 4.86364 | 1 | 3.2 | 3.2 | 25.8 | 25.8 |
| 5.59574 | 1 | 3.2 | 3.2 | 29.0 | 29.0 |
| 5.77119 | 1 | 3.2 | 3.2 | 32.3 | 32.3 |
| 5.84054 | 1 | 3.2 | 3.2 | 35.5 | 35.5 |
| 7.21108 | 1 | 3.2 | 3.2 | 38.7 | 38.7 |
| 10.61568 | 1 | 3.2 | 3.2 | 41.9 | 41.9 |
| 14.49301 | 1 | 3.2 | 3.2 | 45.2 | 45.2 |
| 18.92056 | 1 | 3.2 | 3.2 | 48.4 | 48.4 |
| 25.81514 | 1 | 3.2 | 3.2 | 51.6 | 51.6 |
| 28.90294 | 1 | 3.2 | 3.2 | 54.8 | 54.8 |
| 29.92927 | 1 | 3.2 | 3.2 | 58.1 | 58.1 |
| 29.94574 | 1 | 3.2 | 3.2 | 61.3 | 61.3 |
| 29.95253 | 1 | 3.2 | 3.2 | 64.5 | 64.5 |
| 30.27546 | 1 | 3.2 | 3.2 | 67.7 | 67.7 |
| 30.7707 | 1 | 3.2 | 3.2 | 71.0 | 71.0 |
| 30.99704 | 1 | 3.2 | 3.2 | 74.2 | 74.2 |
| 31.10125 | 1 | 3.2 | 3.2 | 77.4 | 77.4 |
| 31.14242 | 1 | 3.2 | 3.2 | 80.6 | 80.6 |
| 31.24511 | 1 | 3.2 | 3.2 | 83.9 | 83.9 |
| 31.3736 | 1 | 3.2 | 3.2 | 87.1 | 87.1 |
| 32.69694 | 1 | 3.2 | 3.2 | 90.3 | 90.3 |
| 32.77401 | 1 | 3.2 | 3.2 | 93.5 | 93.5 |
| 32.96402 | 1 | 3.2 | 3.2 | 96.8 | 96.8 |
| 54.90196 | 1 | 3.2 | 3.2 | 100.0 | 100.0 |
| Total | 31 | 100.0 | 100.0 | 100.0 | 100.0 |
str(table)
## Classes 'freqtab' and 'data.frame': 32 obs. of 5 variables:
## $ n : num 1 1 1 1 1 1 1 1 1 1 ...
## $ % : num 3.2 3.2 3.2 3.2 3.2 3.2 3.2 3.2 3.2 3.2 ...
## $ val% : num 3.2 3.2 3.2 3.2 3.2 3.2 3.2 3.2 3.2 3.2 ...
## $ %cum : num 3.2 6.5 9.7 12.9 16.1 19.4 22.6 25.8 29 32.3 ...
## $ val%cum: num 3.2 6.5 9.7 12.9 16.1 19.4 22.6 25.8 29 32.3 ...
x <- row.names(table)
y <- table$n
names <- x[1:(length(x)-1)]
freqs <- y[1:(length(y)-1)]
df_ni <- data.frame(x = names, y = freqs)
knitr::kable(df_ni)
| x | y |
|---|---|
| 0.37593 | 1 |
| 0.67752 | 1 |
| 1.36745 | 1 |
| 1.5673 | 1 |
| 1.68056 | 1 |
| 1.97784 | 1 |
| 2.4488 | 1 |
| 4.86364 | 1 |
| 5.59574 | 1 |
| 5.77119 | 1 |
| 5.84054 | 1 |
| 7.21108 | 1 |
| 10.61568 | 1 |
| 14.49301 | 1 |
| 18.92056 | 1 |
| 25.81514 | 1 |
| 28.90294 | 1 |
| 29.92927 | 1 |
| 29.94574 | 1 |
| 29.95253 | 1 |
| 30.27546 | 1 |
| 30.7707 | 1 |
| 30.99704 | 1 |
| 31.10125 | 1 |
| 31.14242 | 1 |
| 31.24511 | 1 |
| 31.3736 | 1 |
| 32.69694 | 1 |
| 32.77401 | 1 |
| 32.96402 | 1 |
| 54.90196 | 1 |
library(ggplot2)
ggplot(data=df_ni, aes(x=x, y=y)) +
geom_bar(stat="identity", color="white", fill="blue") +
xlab("Rango de deslizamiento") +
ylab("Frecuencia")
n_sturges = 1 + log(length(Distance))/log(2)
n_sturgesc = ceiling(n_sturges)
n_sturgesf = floor(n_sturges)
n_clases = 0
if (n_sturgesc%%2 == 0) {
n_clases = n_sturgesf
} else {
n_clases = n_sturgesc
}
R = max(Distance) - min(Distance)
w = ceiling(R/n_clases)
bins <- seq(min(Distance), max(Distance) + w, by = w)
bins
## [1] 0.37593 11.37593 22.37593 33.37593 44.37593 55.37593
Edades <- cut(Distance, bins)
Freq_table <- transform(table(Distance), Rel_Freq=prop.table(Freq), Cum_Freq=cumsum(Freq))
knitr::kable(Freq_table)
| Distance | Freq | Rel_Freq | Cum_Freq |
|---|---|---|---|
| 0.37593 | 1 | 0.0322581 | 1 |
| 0.67752 | 1 | 0.0322581 | 2 |
| 1.36745 | 1 | 0.0322581 | 3 |
| 1.5673 | 1 | 0.0322581 | 4 |
| 1.68056 | 1 | 0.0322581 | 5 |
| 1.97784 | 1 | 0.0322581 | 6 |
| 2.4488 | 1 | 0.0322581 | 7 |
| 4.86364 | 1 | 0.0322581 | 8 |
| 5.59574 | 1 | 0.0322581 | 9 |
| 5.77119 | 1 | 0.0322581 | 10 |
| 5.84054 | 1 | 0.0322581 | 11 |
| 7.21108 | 1 | 0.0322581 | 12 |
| 10.61568 | 1 | 0.0322581 | 13 |
| 14.49301 | 1 | 0.0322581 | 14 |
| 18.92056 | 1 | 0.0322581 | 15 |
| 25.81514 | 1 | 0.0322581 | 16 |
| 28.90294 | 1 | 0.0322581 | 17 |
| 29.92927 | 1 | 0.0322581 | 18 |
| 29.94574 | 1 | 0.0322581 | 19 |
| 29.95253 | 1 | 0.0322581 | 20 |
| 30.27546 | 1 | 0.0322581 | 21 |
| 30.7707 | 1 | 0.0322581 | 22 |
| 30.99704 | 1 | 0.0322581 | 23 |
| 31.10125 | 1 | 0.0322581 | 24 |
| 31.14242 | 1 | 0.0322581 | 25 |
| 31.24511 | 1 | 0.0322581 | 26 |
| 31.3736 | 1 | 0.0322581 | 27 |
| 32.69694 | 1 | 0.0322581 | 28 |
| 32.77401 | 1 | 0.0322581 | 29 |
| 32.96402 | 1 | 0.0322581 | 30 |
| 54.90196 | 1 | 0.0322581 | 31 |
str(Freq_table)
## 'data.frame': 31 obs. of 4 variables:
## $ Distance: Factor w/ 31 levels "0.37593","0.67752",..: 1 2 3 4 5 6 7 8 9 10 ...
## $ Freq : int 1 1 1 1 1 1 1 1 1 1 ...
## $ Rel_Freq: num 0.0323 0.0323 0.0323 0.0323 0.0323 ...
## $ Cum_Freq: int 1 2 3 4 5 6 7 8 9 10 ...
df_ni <- data.frame(x = Freq_table$Distance, y = Freq_table$Freq)
knitr::kable(df_ni)
| x | y |
|---|---|
| 0.37593 | 1 |
| 0.67752 | 1 |
| 1.36745 | 1 |
| 1.5673 | 1 |
| 1.68056 | 1 |
| 1.97784 | 1 |
| 2.4488 | 1 |
| 4.86364 | 1 |
| 5.59574 | 1 |
| 5.77119 | 1 |
| 5.84054 | 1 |
| 7.21108 | 1 |
| 10.61568 | 1 |
| 14.49301 | 1 |
| 18.92056 | 1 |
| 25.81514 | 1 |
| 28.90294 | 1 |
| 29.92927 | 1 |
| 29.94574 | 1 |
| 29.95253 | 1 |
| 30.27546 | 1 |
| 30.7707 | 1 |
| 30.99704 | 1 |
| 31.10125 | 1 |
| 31.14242 | 1 |
| 31.24511 | 1 |
| 31.3736 | 1 |
| 32.69694 | 1 |
| 32.77401 | 1 |
| 32.96402 | 1 |
| 54.90196 | 1 |
library(ggplot2)
ggplot(data=df_ni, aes(x=x, y=y)) +
geom_bar(stat="identity", color="blue", fill="green") +
xlab("Rango de Distance") +
ylab("Frecuencia")
Estos se encargan de la toma de datos cuantitativa con respecto a la información proporcionada, los datos se calculan a partir de la media, mediana, moda, cuartiles etc.
summary(df_ni$Distance)
## Length Class Mode
## 0 NULL NULL
library(pastecs)
stat.desc(df_ni)
## x y
## nbr.val NA 31
## nbr.null NA 0
## nbr.na NA 0
## min NA 1
## max NA 1
## range NA 0
## sum NA 31
## median NA 1
## mean NA 1
## SE.mean NA 0
## CI.mean NA 0
## var NA 0
## std.dev NA 0
## coef.var NA 0
boxplot(Distance, horizontal=TRUE, col='steelblue')
library(readr)
library(knitr)
df_pa <- subset (df, Country == "Panama")
knitr::kable(head(df_pa))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 141 | 750 | 8/26/08 | NA | Panama | PA | Panamá | 1287 | Cerro Azul | 1.84596 | 9.1559 | -79.4295 | (9.1559000000000008, -79.429500000000004) | Landslide | Landslide | Medium | Downpour | NA | NA | http://news.xinhuanet.com/english/2008-08/27/content_9721298.htm | ||||
| 167 | 905 | 11/25/08 | NA | Panama | PA | Chiriquí | 6123 | Boquete | 9.83700 | 8.7870 | -82.3440 | (8.7870000000000008, -82.343999999999994) | Landslide | Complex | Medium | Downpour | NA | 8 | http://www.iht.com/articles/ap/2008/11/26/news/LT-Panama-Flooding.php | ||||
| 557 | 2794 | 12/8/10 | NA | Panama | PA | Colón | 1310 | El Giral | 1.80330 | 9.2332 | -79.6961 | (9.2332000000000001, -79.696100000000001) | Landslide | Landslide | Medium | Downpour | NA | 0 | http://www.portworld.com/news/i98731/Panama_Canal_disrupted_by_floods | ||||
| 558 | 2795 | 12/9/10 | Morning | NA | Panama | PA | Colón | 1274 | Portobelo | 0.09491 | Deforested slope | 9.5493 | -79.6505 | (9.5493000000000006, -79.650499999999994) | Landslide | Mudslide | Medium | Downpour | NA | 8 | Fox News Latino | http://latino.foxnews.com/latino/news/2010/12/09/heavy-rains-kill-panama-force-canal-close/ | |
| 591 | 3167 | 3/2/11 | Night | NA | Panama | PA | Los Santos | 1283 | La Palma | 13.40535 | 7.5955 | -80.3800 | (7.5955000000000004, -80.38) | Landslide | Landslide | Medium | Downpour | NA | 0 | http://www.newsroompanama.com/panama/2434-off-season-rain-creating-crop-worries-and-landslides.html | |||
| 592 | 3168 | 3/2/11 | Night | NA | Panama | PA | Bocas del Toro | 8114 | Almirante | 8.41491 | 9.3224 | -82.4732 | (9.3224, -82.473200000000006) | Landslide | Landslide | Medium | Downpour | NA | 0 | http://www.newsroompanama.com/panama/2434-off-season-rain-creating-crop-worries-and-landslides.html |
df_pa %>%
select(Country, State, City, Distance)
## Country State City Distance
## 141 Panama Panamá Cerro Azul 1.84596
## 167 Panama Chiriquí Boquete 9.83700
## 557 Panama Colón El Giral 1.80330
## 558 Panama Colón Portobelo 0.09491
## 591 Panama Los Santos La Palma 13.40535
## 592 Panama Bocas del Toro Almirante 8.41491
## 919 Panama Colón Colón 0.16894
## 979 Panama Colón Portobelo 2.67409
## 980 Panama Colón Margarita 0.74760
## 981 Panama Colón Colón 0.20365
## 1080 Panama Colón Margarita 0.76740
## 1166 Panama Panamá Las Cumbres 2.81479
## 1387 Panama Chiriquí Volcán 0.35187
## 1388 Panama Chiriquí Río Sereno 0.64491
## 1389 Panama Panamá Alcaldedíaz 1.41526
## 1390 Panama Colón Nuevo San Juan 4.74914
## 1391 Panama Panamá San Miguelito 4.18074
## 1392 Panama Chiriquí Cerro Punta 3.33873
## 1393 Panama Panamá Ancón 2.24069
## 1606 Panama Colón Nueva Providencia 0.18619
## 1607 Panama Colón María Chiquita 2.28589
## 1608 Panama Colón Cativá 0.63948
## 1609 Panama Panamá Las Margaritas 0.48725
## 1645 Panama Bocas del Toro Punta Peña 0.29869
## 1653 Panama Bocas del Toro Changuinola 5.97977
## 1654 Panama Bocas del Toro Valle del Risco 6.65185
## 1655 Panama Bocas del Toro Pueblo Nuevo 3.92621
## 1656 Panama Bocas del Toro Valle del Risco 5.13913
## 1657 Panama Bocas del Toro Cauchero 4.45630
## 1658 Panama Chiriquí Boca de Balsa 2.44254
## 1659 Panama Chiriquí Río Sereno 3.66775
## 1660 Panama Chiriquí Palmira Centro 0.90169
## 1661 Panama Chiriquí Breñón 0.37999
## 1662 Panama Panamá San Miguelito 2.57852
## 1663 Panama Chiriquí Monte Lirio 6.74338
## 1664 Panama Coclé Caballero 0.21605
## 1665 Panama Panamá San Miguelito 2.59449
## 1666 Panama Panamá San Miguelito 3.30848
## 1667 Panama Panamá San Miguelito 3.54386
## 1668 Panama Panamá Arraiján 1.80341
library(ggplot2)
ggplot(data=df_pa, aes(x= State , y= Distance)) + geom_bar(stat="identity", color="black", fill="purple")
library(ggplot2)
library(dplyr)
ggplot(data=df_pa, aes(fill=City, x="Panama", y=Distance)) +
geom_bar(position="dodge", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_pa, aes(fill=City, x="Panama", y=Distance)) +
geom_bar(position="stack", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_pa, aes(x = "Panama", y = Distance , fill=City)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y", start = 0)
library(qcc)
Distance <- df_pa$Distance
names(Distance) <- df_pa$City
pareto.chart(Distance,
ylab="Distance",
col = heat.colors(length(Distance)),
cumperc = seq(0, 100, by = 10),
ylab2 = "Porcentaje acumulado",
main = "DONDE SE CONCENTRAN LAS CIUDADES CON MAYORES DESLIZAMIENTOS")
##
## Pareto chart analysis for Distance
## Frequency Cum.Freq. Percentage Cum.Percent.
## La Palma 13.40535000 13.40535000 11.36719394 11.36719394
## Boquete 9.83700000 23.24235000 8.34137764 19.70857158
## Almirante 8.41491000 31.65726000 7.13550291 26.84407449
## Monte Lirio 6.74338000 38.40064000 5.71811316 32.56218765
## Valle del Risco 6.65185000 45.05249000 5.64049943 38.20268708
## Changuinola 5.97977000 51.03226000 5.07060280 43.27328989
## Valle del Risco 5.13913000 56.17139000 4.35777413 47.63106401
## Nuevo San Juan 4.74914000 60.92053000 4.02707840 51.65814241
## Cauchero 4.45630000 65.37683000 3.77876194 55.43690435
## San Miguelito 4.18074000 69.55757000 3.54509822 58.98200257
## Pueblo Nuevo 3.92621000 73.48378000 3.32926708 62.31126965
## Río Sereno 3.66775000 77.15153000 3.11010347 65.42137312
## San Miguelito 3.54386000 80.69539000 3.00504977 68.42642289
## Cerro Punta 3.33873000 84.03412000 2.83110784 71.25753073
## San Miguelito 3.30848000 87.34260000 2.80545706 74.06298779
## Las Cumbres 2.81479000 90.15739000 2.38682793 76.44981572
## Portobelo 2.67409000 92.83148000 2.26752003 78.71733575
## San Miguelito 2.59449000 95.42597000 2.20002245 80.91735821
## San Miguelito 2.57852000 98.00449000 2.18648054 83.10383875
## Boca de Balsa 2.44254000 100.44703000 2.07117501 85.17501375
## María Chiquita 2.28589000 102.73292000 1.93834215 87.11335590
## Ancón 2.24069000 104.97361000 1.90001438 89.01337029
## Cerro Azul 1.84596000 106.81957000 1.56529933 90.57866961
## Arraiján 1.80341000 108.62298000 1.52921865 92.10788826
## El Giral 1.80330000 110.42628000 1.52912537 93.63701364
## Alcaldedíaz 1.41526000 111.84154000 1.20008317 94.83709680
## Palmira Centro 0.90169000 112.74323000 0.76459661 95.60169341
## Margarita 0.76740000 113.51063000 0.65072412 96.25241753
## Margarita 0.74760000 114.25823000 0.63393453 96.88635206
## Río Sereno 0.64491000 114.90314000 0.54685756 97.43320962
## Cativá 0.63948000 115.54262000 0.54225314 97.97546277
## Las Margaritas 0.48725000 116.02987000 0.41316827 98.38863103
## Breñón 0.37999000 116.40986000 0.32221613 98.71084717
## Volcán 0.35187000 116.76173000 0.29837151 99.00921868
## Punta Peña 0.29869000 117.06042000 0.25327702 99.26249570
## Caballero 0.21605000 117.27647000 0.18320165 99.44569735
## Colón 0.20365000 117.48012000 0.17268695 99.61838430
## Nueva Providencia 0.18619000 117.66631000 0.15788158 99.77626588
## Colón 0.16894000 117.83525000 0.14325428 99.91952016
## Portobelo 0.09491000 117.93016000 0.08047984 100.00000000
stem(df_pa$"Distance")
##
## The decimal point is at the |
##
## 0 | 122223445667894888
## 2 | 234667833579
## 4 | 2571
## 6 | 077
## 8 | 48
## 10 |
## 12 | 4
head(df_pa)
## id date time continent_code Country country_code State
## 141 750 8/26/08 <NA> Panama PA Panamá
## 167 905 11/25/08 <NA> Panama PA Chiriquí
## 557 2794 12/8/10 <NA> Panama PA Colón
## 558 2795 12/9/10 Morning <NA> Panama PA Colón
## 591 3167 3/2/11 Night <NA> Panama PA Los Santos
## 592 3168 3/2/11 Night <NA> Panama PA Bocas del Toro
## population City Distance location_description latitude longitude
## 141 1287 Cerro Azul 1.84596 9.1559 -79.4295
## 167 6123 Boquete 9.83700 8.7870 -82.3440
## 557 1310 El Giral 1.80330 9.2332 -79.6961
## 558 1274 Portobelo 0.09491 Deforested slope 9.5493 -79.6505
## 591 1283 La Palma 13.40535 7.5955 -80.3800
## 592 8114 Almirante 8.41491 9.3224 -82.4732
## geolocation hazard_type landslide_type
## 141 (9.1559000000000008, -79.429500000000004) Landslide Landslide
## 167 (8.7870000000000008, -82.343999999999994) Landslide Complex
## 557 (9.2332000000000001, -79.696100000000001) Landslide Landslide
## 558 (9.5493000000000006, -79.650499999999994) Landslide Mudslide
## 591 (7.5955000000000004, -80.38) Landslide Landslide
## 592 (9.3224, -82.473200000000006) Landslide Landslide
## landslide_size trigger storm_name injuries fatalities source_name
## 141 Medium Downpour NA NA
## 167 Medium Downpour NA 8
## 557 Medium Downpour NA 0
## 558 Medium Downpour NA 8 Fox News Latino
## 591 Medium Downpour NA 0
## 592 Medium Downpour NA 0
## source_link
## 141 http://news.xinhuanet.com/english/2008-08/27/content_9721298.htm
## 167 http://www.iht.com/articles/ap/2008/11/26/news/LT-Panama-Flooding.php
## 557 http://www.portworld.com/news/i98731/Panama_Canal_disrupted_by_floods
## 558 http://latino.foxnews.com/latino/news/2010/12/09/heavy-rains-kill-panama-force-canal-close/
## 591 http://www.newsroompanama.com/panama/2434-off-season-rain-creating-crop-worries-and-landslides.html
## 592 http://www.newsroompanama.com/panama/2434-off-season-rain-creating-crop-worries-and-landslides.html
knitr::kable(head(df_pa))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 141 | 750 | 8/26/08 | NA | Panama | PA | Panamá | 1287 | Cerro Azul | 1.84596 | 9.1559 | -79.4295 | (9.1559000000000008, -79.429500000000004) | Landslide | Landslide | Medium | Downpour | NA | NA | http://news.xinhuanet.com/english/2008-08/27/content_9721298.htm | ||||
| 167 | 905 | 11/25/08 | NA | Panama | PA | Chiriquí | 6123 | Boquete | 9.83700 | 8.7870 | -82.3440 | (8.7870000000000008, -82.343999999999994) | Landslide | Complex | Medium | Downpour | NA | 8 | http://www.iht.com/articles/ap/2008/11/26/news/LT-Panama-Flooding.php | ||||
| 557 | 2794 | 12/8/10 | NA | Panama | PA | Colón | 1310 | El Giral | 1.80330 | 9.2332 | -79.6961 | (9.2332000000000001, -79.696100000000001) | Landslide | Landslide | Medium | Downpour | NA | 0 | http://www.portworld.com/news/i98731/Panama_Canal_disrupted_by_floods | ||||
| 558 | 2795 | 12/9/10 | Morning | NA | Panama | PA | Colón | 1274 | Portobelo | 0.09491 | Deforested slope | 9.5493 | -79.6505 | (9.5493000000000006, -79.650499999999994) | Landslide | Mudslide | Medium | Downpour | NA | 8 | Fox News Latino | http://latino.foxnews.com/latino/news/2010/12/09/heavy-rains-kill-panama-force-canal-close/ | |
| 591 | 3167 | 3/2/11 | Night | NA | Panama | PA | Los Santos | 1283 | La Palma | 13.40535 | 7.5955 | -80.3800 | (7.5955000000000004, -80.38) | Landslide | Landslide | Medium | Downpour | NA | 0 | http://www.newsroompanama.com/panama/2434-off-season-rain-creating-crop-worries-and-landslides.html | |||
| 592 | 3168 | 3/2/11 | Night | NA | Panama | PA | Bocas del Toro | 8114 | Almirante | 8.41491 | 9.3224 | -82.4732 | (9.3224, -82.473200000000006) | Landslide | Landslide | Medium | Downpour | NA | 0 | http://www.newsroompanama.com/panama/2434-off-season-rain-creating-crop-worries-and-landslides.html |
stem(df_pa$"Distance")
##
## The decimal point is at the |
##
## 0 | 122223445667894888
## 2 | 234667833579
## 4 | 2571
## 6 | 077
## 8 | 48
## 10 |
## 12 | 4
stem(df_pa$"Distance", scale = 2)
##
## The decimal point is at the |
##
## 0 | 12222344566789
## 1 | 4888
## 2 | 2346678
## 3 | 33579
## 4 | 257
## 5 | 1
## 6 | 077
## 7 |
## 8 | 4
## 9 | 8
## 10 |
## 11 |
## 12 |
## 13 | 4
library(forecast)
data<- ts(df_pa$Distance, frequency=12, start=2008)
knitr::kable(head(data))
| x |
|---|
| 1.84596 |
| 9.83700 |
| 1.80330 |
| 0.09491 |
| 13.40535 |
| 8.41491 |
autoplot(data) + labs(title = "Gráfico de series temporales", x="date", y = "distancia", colour = "green") +theme_bw()
library(questionr)
table <- questionr::freq(Distance, cum = TRUE, sort = "dec", total = TRUE)
knitr::kable(table)
| n | % | val% | %cum | val%cum | |
|---|---|---|---|---|---|
| 0.09491 | 1 | 2.5 | 2.5 | 2.5 | 2.5 |
| 0.16894 | 1 | 2.5 | 2.5 | 5.0 | 5.0 |
| 0.18619 | 1 | 2.5 | 2.5 | 7.5 | 7.5 |
| 0.20365 | 1 | 2.5 | 2.5 | 10.0 | 10.0 |
| 0.21605 | 1 | 2.5 | 2.5 | 12.5 | 12.5 |
| 0.29869 | 1 | 2.5 | 2.5 | 15.0 | 15.0 |
| 0.35187 | 1 | 2.5 | 2.5 | 17.5 | 17.5 |
| 0.37999 | 1 | 2.5 | 2.5 | 20.0 | 20.0 |
| 0.48725 | 1 | 2.5 | 2.5 | 22.5 | 22.5 |
| 0.63948 | 1 | 2.5 | 2.5 | 25.0 | 25.0 |
| 0.64491 | 1 | 2.5 | 2.5 | 27.5 | 27.5 |
| 0.7476 | 1 | 2.5 | 2.5 | 30.0 | 30.0 |
| 0.7674 | 1 | 2.5 | 2.5 | 32.5 | 32.5 |
| 0.90169 | 1 | 2.5 | 2.5 | 35.0 | 35.0 |
| 1.41526 | 1 | 2.5 | 2.5 | 37.5 | 37.5 |
| 1.8033 | 1 | 2.5 | 2.5 | 40.0 | 40.0 |
| 1.80341 | 1 | 2.5 | 2.5 | 42.5 | 42.5 |
| 1.84596 | 1 | 2.5 | 2.5 | 45.0 | 45.0 |
| 2.24069 | 1 | 2.5 | 2.5 | 47.5 | 47.5 |
| 2.28589 | 1 | 2.5 | 2.5 | 50.0 | 50.0 |
| 2.44254 | 1 | 2.5 | 2.5 | 52.5 | 52.5 |
| 2.57852 | 1 | 2.5 | 2.5 | 55.0 | 55.0 |
| 2.59449 | 1 | 2.5 | 2.5 | 57.5 | 57.5 |
| 2.67409 | 1 | 2.5 | 2.5 | 60.0 | 60.0 |
| 2.81479 | 1 | 2.5 | 2.5 | 62.5 | 62.5 |
| 3.30848 | 1 | 2.5 | 2.5 | 65.0 | 65.0 |
| 3.33873 | 1 | 2.5 | 2.5 | 67.5 | 67.5 |
| 3.54386 | 1 | 2.5 | 2.5 | 70.0 | 70.0 |
| 3.66775 | 1 | 2.5 | 2.5 | 72.5 | 72.5 |
| 3.92621 | 1 | 2.5 | 2.5 | 75.0 | 75.0 |
| 4.18074 | 1 | 2.5 | 2.5 | 77.5 | 77.5 |
| 4.4563 | 1 | 2.5 | 2.5 | 80.0 | 80.0 |
| 4.74914 | 1 | 2.5 | 2.5 | 82.5 | 82.5 |
| 5.13913 | 1 | 2.5 | 2.5 | 85.0 | 85.0 |
| 5.97977 | 1 | 2.5 | 2.5 | 87.5 | 87.5 |
| 6.65185 | 1 | 2.5 | 2.5 | 90.0 | 90.0 |
| 6.74338 | 1 | 2.5 | 2.5 | 92.5 | 92.5 |
| 8.41491 | 1 | 2.5 | 2.5 | 95.0 | 95.0 |
| 9.837 | 1 | 2.5 | 2.5 | 97.5 | 97.5 |
| 13.40535 | 1 | 2.5 | 2.5 | 100.0 | 100.0 |
| Total | 40 | 100.0 | 100.0 | 100.0 | 100.0 |
str(table)
## Classes 'freqtab' and 'data.frame': 41 obs. of 5 variables:
## $ n : num 1 1 1 1 1 1 1 1 1 1 ...
## $ % : num 2.5 2.5 2.5 2.5 2.5 2.5 2.5 2.5 2.5 2.5 ...
## $ val% : num 2.5 2.5 2.5 2.5 2.5 2.5 2.5 2.5 2.5 2.5 ...
## $ %cum : num 2.5 5 7.5 10 12.5 15 17.5 20 22.5 25 ...
## $ val%cum: num 2.5 5 7.5 10 12.5 15 17.5 20 22.5 25 ...
x <- row.names(table)
y <- table$n
names <- x[1:(length(x)-1)]
freqs <- y[1:(length(y)-1)]
df_pa <- data.frame(x = names, y = freqs)
knitr::kable(df_pa)
| x | y |
|---|---|
| 0.09491 | 1 |
| 0.16894 | 1 |
| 0.18619 | 1 |
| 0.20365 | 1 |
| 0.21605 | 1 |
| 0.29869 | 1 |
| 0.35187 | 1 |
| 0.37999 | 1 |
| 0.48725 | 1 |
| 0.63948 | 1 |
| 0.64491 | 1 |
| 0.7476 | 1 |
| 0.7674 | 1 |
| 0.90169 | 1 |
| 1.41526 | 1 |
| 1.8033 | 1 |
| 1.80341 | 1 |
| 1.84596 | 1 |
| 2.24069 | 1 |
| 2.28589 | 1 |
| 2.44254 | 1 |
| 2.57852 | 1 |
| 2.59449 | 1 |
| 2.67409 | 1 |
| 2.81479 | 1 |
| 3.30848 | 1 |
| 3.33873 | 1 |
| 3.54386 | 1 |
| 3.66775 | 1 |
| 3.92621 | 1 |
| 4.18074 | 1 |
| 4.4563 | 1 |
| 4.74914 | 1 |
| 5.13913 | 1 |
| 5.97977 | 1 |
| 6.65185 | 1 |
| 6.74338 | 1 |
| 8.41491 | 1 |
| 9.837 | 1 |
| 13.40535 | 1 |
library(ggplot2)
ggplot(data=df_pa, aes(x=x, y=y)) +
geom_bar(stat="identity", color="white", fill="blue") +
xlab("Rango de deslizamiento") +
ylab("Frecuencia")
n_sturges = 1 + log(length(Distance))/log(2)
n_sturgesc = ceiling(n_sturges)
n_sturgesf = floor(n_sturges)
n_clases = 0
if (n_sturgesc%%2 == 0) {
n_clases = n_sturgesf
} else {
n_clases = n_sturgesc
}
R = max(Distance) - min(Distance)
w = ceiling(R/n_clases)
bins <- seq(min(Distance), max(Distance) + w, by = w)
bins
## [1] 0.09491 2.09491 4.09491 6.09491 8.09491 10.09491 12.09491 14.09491
Edades <- cut(Distance, bins)
Freq_table <- transform(table(Distance), Rel_Freq=prop.table(Freq), Cum_Freq=cumsum(Freq))
knitr::kable(Freq_table)
| Distance | Freq | Rel_Freq | Cum_Freq |
|---|---|---|---|
| 0.09491 | 1 | 0.025 | 1 |
| 0.16894 | 1 | 0.025 | 2 |
| 0.18619 | 1 | 0.025 | 3 |
| 0.20365 | 1 | 0.025 | 4 |
| 0.21605 | 1 | 0.025 | 5 |
| 0.29869 | 1 | 0.025 | 6 |
| 0.35187 | 1 | 0.025 | 7 |
| 0.37999 | 1 | 0.025 | 8 |
| 0.48725 | 1 | 0.025 | 9 |
| 0.63948 | 1 | 0.025 | 10 |
| 0.64491 | 1 | 0.025 | 11 |
| 0.7476 | 1 | 0.025 | 12 |
| 0.7674 | 1 | 0.025 | 13 |
| 0.90169 | 1 | 0.025 | 14 |
| 1.41526 | 1 | 0.025 | 15 |
| 1.8033 | 1 | 0.025 | 16 |
| 1.80341 | 1 | 0.025 | 17 |
| 1.84596 | 1 | 0.025 | 18 |
| 2.24069 | 1 | 0.025 | 19 |
| 2.28589 | 1 | 0.025 | 20 |
| 2.44254 | 1 | 0.025 | 21 |
| 2.57852 | 1 | 0.025 | 22 |
| 2.59449 | 1 | 0.025 | 23 |
| 2.67409 | 1 | 0.025 | 24 |
| 2.81479 | 1 | 0.025 | 25 |
| 3.30848 | 1 | 0.025 | 26 |
| 3.33873 | 1 | 0.025 | 27 |
| 3.54386 | 1 | 0.025 | 28 |
| 3.66775 | 1 | 0.025 | 29 |
| 3.92621 | 1 | 0.025 | 30 |
| 4.18074 | 1 | 0.025 | 31 |
| 4.4563 | 1 | 0.025 | 32 |
| 4.74914 | 1 | 0.025 | 33 |
| 5.13913 | 1 | 0.025 | 34 |
| 5.97977 | 1 | 0.025 | 35 |
| 6.65185 | 1 | 0.025 | 36 |
| 6.74338 | 1 | 0.025 | 37 |
| 8.41491 | 1 | 0.025 | 38 |
| 9.837 | 1 | 0.025 | 39 |
| 13.40535 | 1 | 0.025 | 40 |
str(Freq_table)
## 'data.frame': 40 obs. of 4 variables:
## $ Distance: Factor w/ 40 levels "0.09491","0.16894",..: 1 2 3 4 5 6 7 8 9 10 ...
## $ Freq : int 1 1 1 1 1 1 1 1 1 1 ...
## $ Rel_Freq: num 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 0.025 ...
## $ Cum_Freq: int 1 2 3 4 5 6 7 8 9 10 ...
df_pa <- data.frame(x = Freq_table$Distance, y = Freq_table$Freq)
knitr::kable(df_pa)
| x | y |
|---|---|
| 0.09491 | 1 |
| 0.16894 | 1 |
| 0.18619 | 1 |
| 0.20365 | 1 |
| 0.21605 | 1 |
| 0.29869 | 1 |
| 0.35187 | 1 |
| 0.37999 | 1 |
| 0.48725 | 1 |
| 0.63948 | 1 |
| 0.64491 | 1 |
| 0.7476 | 1 |
| 0.7674 | 1 |
| 0.90169 | 1 |
| 1.41526 | 1 |
| 1.8033 | 1 |
| 1.80341 | 1 |
| 1.84596 | 1 |
| 2.24069 | 1 |
| 2.28589 | 1 |
| 2.44254 | 1 |
| 2.57852 | 1 |
| 2.59449 | 1 |
| 2.67409 | 1 |
| 2.81479 | 1 |
| 3.30848 | 1 |
| 3.33873 | 1 |
| 3.54386 | 1 |
| 3.66775 | 1 |
| 3.92621 | 1 |
| 4.18074 | 1 |
| 4.4563 | 1 |
| 4.74914 | 1 |
| 5.13913 | 1 |
| 5.97977 | 1 |
| 6.65185 | 1 |
| 6.74338 | 1 |
| 8.41491 | 1 |
| 9.837 | 1 |
| 13.40535 | 1 |
library(ggplot2)
ggplot(data=df_pa, aes(x=x, y=y)) +
geom_bar(stat="identity", color="blue", fill="green") +
xlab("Rango de Distance") +
ylab("Frecuencia")
Estos se encargan de la toma de datos cuantitativa con respecto a la información proporcionada, los datos se calculan a partir de la media, mediana, moda, cuartiles etc.
summary(df_pa$Distance)
## Length Class Mode
## 0 NULL NULL
library(pastecs)
stat.desc(df_pa)
## x y
## nbr.val NA 40
## nbr.null NA 0
## nbr.na NA 0
## min NA 1
## max NA 1
## range NA 0
## sum NA 40
## median NA 1
## mean NA 1
## SE.mean NA 0
## CI.mean NA 0
## var NA 0
## std.dev NA 0
## coef.var NA 0
boxplot(Distance, horizontal=TRUE, col='steelblue')
library(readr)
library(knitr)
df_mx <- subset (df, Country == "Mexico")
knitr::kable(head(df_mx))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 13 | 115 | 7/4/07 | NA | Mexico | MX | Veracruz-Llave | 1947 | Laguna Chica (Pueblo Nuevo) | 9.51003 | 18.5369 | -96.8229 | (18.536899999999999, -96.822900000000004) | Landslide | Landslide | Medium | Rain | NA | 7 | nytimes.com | http://www.nytimes.com/2007/07/04/world/americas/04cnd-mexico.html?_r=1&hp&oref=slogin | |||
| 29 | 201 | 8/23/07 | NA | Mexico | MX | Puebla | 1414 | Xochitlaxco (San Baltazar) | 1.68294 | 19.9333 | -97.8500 | (19.933299999999999, -97.85) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Dean | NA | 6 | Inquirer.com | http://newsinfo.inquirer.net/breakingnews/world/view_article.php?article_id=84452 | ||
| 31 | 225 | 9/2/07 | NA | Mexico | MX | Sinaloa | 3191 | El Limón de los Ramos | 10.88351 | 24.9531 | -107.6220 | (24.953099999999999, -107.622) | Landslide | Complex | Medium | Tropical cyclone | Tropical Storm Henrietta | NA | 3 | ||||
| 42 | 284 | 9/28/07 | NA | Mexico | MX | Puebla | 3761 | Xaltepuxtla | 7.93258 | 20.2000 | -97.9000 | (20.2, -97.9) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Lorenzo | NA | 1 | PressTV.ir | http://www.presstv.ir/detail.aspx?id=25037§ionid=3510207 | ||
| 57 | 342 | 10/31/07 | NA | Mexico | MX | Tabasco | 4468 | Buenavista | 4.19108 | 17.9493 | -92.5534 | (17.949300000000001, -92.553399999999996) | Landslide | Landslide | Medium | Rain | NA | 18 | CapeTimes | http://www.capetimes.co.za/?fArticleId=4109453 | |||
| 59 | 346 | 11/4/07 | NA | Mexico | MX | Chiapas | 3183 | Ostuacán | 3.74149 | 17.3900 | -93.3060 | (17.39, -93.305999999999997) | Landslide | Mudslide | Very_large | Rain | NA | 5 | Reuters - AlertNet.org | http://news.monstersandcritics.com/americas/news/article_1371436.php/Mudslide_is_latest_disaster_for_hard-hit_Mexico__2nd_Roundup_ |
library(readr)
library(knitr)
df_vl <- subset (df, State == "Veracruz-Llave")
df_vl %>%
select(Country, State, City, Distance)
## Country State City Distance
## 13 Mexico Veracruz-Llave Laguna Chica (Pueblo Nuevo) 9.51003
## 445 Mexico Veracruz-Llave El Hatito 8.28739
## 764 Mexico Veracruz-Llave Xalapa de Enríquez 1.27837
## 1095 Mexico Veracruz-Llave Coatzintla 1.52983
## 1096 Mexico Veracruz-Llave Altotonga 2.85382
## 1097 Mexico Veracruz-Llave Yecuatla 3.73160
## 1118 Mexico Veracruz-Llave Heroica Coscomatepec de Bravo 0.09971
## 1152 Mexico Veracruz-Llave Altotonga 0.50188
## 1158 Mexico Veracruz-Llave Tetlaxco 4.51820
library(ggplot2)
ggplot(data=df_vl, aes(x= State , y= Distance)) + geom_bar(stat="identity", color="black", fill="purple")
library(ggplot2)
library(dplyr)
ggplot(data=df_vl, aes(fill=City, x="Veracruz-Llave", y=Distance)) +
geom_bar(position="dodge", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_vl, aes(fill=City, x="Veracruz-Llave", y=Distance)) +
geom_bar(position="stack", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_vl, aes(x = "Veracruz-Llave", y = Distance , fill=City)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y", start = 0)
library(ggplot2)
library(dplyr)
df_vl <- df_vl %>%
arrange(desc(City)) %>%
mutate(prop = Distance / sum(df_vl$Distance) *100) %>%
mutate(ypos = cumsum(prop)- 0.5*prop )
require(scales)
## Loading required package: scales
##
## Attaching package: 'scales'
## The following object is masked from 'package:readr':
##
## col_factor
ggplot(df_vl, aes(x= State, y = prop, fill=City)) +
geom_bar(stat="identity", width=1, color="black") +
coord_polar("y", start=0) +
theme_void() +
theme(legend.position="none") +
geom_text(aes(y = ypos, label = percent(prop/100)), color = "black", size=3) +
scale_fill_brewer(palette="Set4")
## Warning in pal_name(palette, type): Unknown palette Set4
library(qcc)
Distance <- df_vl$Distance
names(Distance) <- df_vl$City
pareto.chart(Distance,
ylab="Distance",
col = heat.colors(length(Distance)),
cumperc = seq(0, 100, by = 10),
ylab2 = "Porcentaje acumulado",
main = "DONDE SE CONCENTRAN LAS CIUDADES CON MAYORES DESLIZAMIENTOS")
##
## Pareto chart analysis for Distance
## Frequency Cum.Freq. Percentage
## Laguna Chica (Pueblo Nuevo) 9.5100300 9.5100300 29.4329486
## El Hatito 8.2873900 17.7974200 25.6489542
## Tetlaxco 4.5182000 22.3156200 13.9835467
## Yecuatla 3.7316000 26.0472200 11.5490688
## Altotonga 2.8538200 28.9010400 8.8323946
## Coatzintla 1.5298300 30.4308700 4.7347283
## Xalapa de Enríquez 1.2783700 31.7092400 3.9564753
## Altotonga 0.5018800 32.2111200 1.5532872
## Heroica Coscomatepec de Bravo 0.0997100 32.3108300 0.3085962
##
## Pareto chart analysis for Distance
## Cum.Percent.
## Laguna Chica (Pueblo Nuevo) 29.4329486
## El Hatito 55.0819029
## Tetlaxco 69.0654496
## Yecuatla 80.6145184
## Altotonga 89.4469130
## Coatzintla 94.1816413
## Xalapa de Enríquez 98.1381165
## Altotonga 99.6914038
## Heroica Coscomatepec de Bravo 100.0000000
stem(df_vl$"Distance")
##
## The decimal point is at the |
##
## 0 | 1535
## 2 | 97
## 4 | 5
## 6 |
## 8 | 35
head(df_vl)
## id date time continent_code Country country_code State
## 1 5406 8/26/13 <NA> Mexico MX Veracruz-Llave
## 2 3684 7/1/11 <NA> Mexico MX Veracruz-Llave
## 3 5542 9/16/13 <NA> Mexico MX Veracruz-Llave
## 4 115 7/4/07 <NA> Mexico MX Veracruz-Llave
## 5 5486 9/9/13 Night <NA> Mexico MX Veracruz-Llave
## 6 2438 9/17/10 <NA> Mexico MX Veracruz-Llave
## population City Distance location_description
## 1 3198 Yecuatla 3.73160
## 2 425148 Xalapa de Enríquez 1.27837
## 3 1543 Tetlaxco 4.51820
## 4 1947 Laguna Chica (Pueblo Nuevo) 9.51003
## 5 12920 Heroica Coscomatepec de Bravo 0.09971
## 6 1324 El Hatito 8.28739
## latitude longitude geolocation hazard_type
## 1 19.8413 -96.8005 (19.8413, -96.8005) Landslide
## 2 19.5426 -96.9137 (19.5426, -96.913700000000006) Landslide
## 3 19.0603 -97.1009 (19.060300000000002, -97.100899999999996) Landslide
## 4 18.5369 -96.8229 (18.536899999999999, -96.822900000000004) Landslide
## 5 19.0719 -97.0474 (19.071899999999999, -97.047399999999996) Landslide
## 6 19.2818 -96.3149 (19.2818, -96.314899999999994) Landslide
## landslide_type landslide_size trigger storm_name injuries
## 1 Landslide Medium Downpour NA
## 2 Mudslide Medium Tropical cyclone Tropical Storm Arlene NA
## 3 Landslide Medium Tropical cyclone Manuel NA
## 4 Landslide Medium Rain NA
## 5 Landslide Medium Downpour 2
## 6 Landslide Medium Tropical cyclone Hurricane Karl NA
## fatalities source_name
## 1 9 www.cbc.ca
## 2 0
## 3 13 www.raymondvillechroniclenews.com
## 4 7 nytimes.com
## 5 14 infosurhoy.com
## 6 2
## source_link
## 1 http://www.cbc.ca/news/world/mexico-storm-related-landslides-kill-13-1.1370491
## 2 http://edition.cnn.com/2011/WORLD/americas/07/04/mexico.arlene.deaths/
## 3 http://www.raymondvillechroniclenews.com/news/2013-09-18/News/Mexican_village_buries_13_victims_of_mudslide.html
## 4 http://www.nytimes.com/2007/07/04/world/americas/04cnd-mexico.html?_r=1&hp&oref=slogin
## 5 http://infosurhoy.com/en_GB/articles/saii/newsbriefs/2013/09/12/newsbrief-03
## 6 http://www.lfpress.com/news/world/2010/09/17/15382976-reuters.html
## prop ypos
## 1 11.5490688 5.774534
## 2 3.9564753 13.527306
## 3 13.9835467 22.497317
## 4 29.4329486 44.205565
## 5 0.3085962 59.076338
## 6 25.6489542 72.055113
knitr::kable(head(df_vl))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | prop | ypos |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5406 | 8/26/13 | NA | Mexico | MX | Veracruz-Llave | 3198 | Yecuatla | 3.73160 | 19.8413 | -96.8005 | (19.8413, -96.8005) | Landslide | Landslide | Medium | Downpour | NA | 9 | www.cbc.ca | http://www.cbc.ca/news/world/mexico-storm-related-landslides-kill-13-1.1370491 | 11.5490688 | 5.774534 | |||
| 3684 | 7/1/11 | NA | Mexico | MX | Veracruz-Llave | 425148 | Xalapa de Enríquez | 1.27837 | 19.5426 | -96.9137 | (19.5426, -96.913700000000006) | Landslide | Mudslide | Medium | Tropical cyclone | Tropical Storm Arlene | NA | 0 | http://edition.cnn.com/2011/WORLD/americas/07/04/mexico.arlene.deaths/ | 3.9564753 | 13.527306 | |||
| 5542 | 9/16/13 | NA | Mexico | MX | Veracruz-Llave | 1543 | Tetlaxco | 4.51820 | 19.0603 | -97.1009 | (19.060300000000002, -97.100899999999996) | Landslide | Landslide | Medium | Tropical cyclone | Manuel | NA | 13 | www.raymondvillechroniclenews.com | http://www.raymondvillechroniclenews.com/news/2013-09-18/News/Mexican_village_buries_13_victims_of_mudslide.html | 13.9835467 | 22.497318 | ||
| 115 | 7/4/07 | NA | Mexico | MX | Veracruz-Llave | 1947 | Laguna Chica (Pueblo Nuevo) | 9.51003 | 18.5369 | -96.8229 | (18.536899999999999, -96.822900000000004) | Landslide | Landslide | Medium | Rain | NA | 7 | nytimes.com | http://www.nytimes.com/2007/07/04/world/americas/04cnd-mexico.html?_r=1&hp&oref=slogin | 29.4329486 | 44.205565 | |||
| 5486 | 9/9/13 | Night | NA | Mexico | MX | Veracruz-Llave | 12920 | Heroica Coscomatepec de Bravo | 0.09971 | 19.0719 | -97.0474 | (19.071899999999999, -97.047399999999996) | Landslide | Landslide | Medium | Downpour | 2 | 14 | infosurhoy.com | http://infosurhoy.com/en_GB/articles/saii/newsbriefs/2013/09/12/newsbrief-03 | 0.3085962 | 59.076338 | ||
| 2438 | 9/17/10 | NA | Mexico | MX | Veracruz-Llave | 1324 | El Hatito | 8.28739 | 19.2818 | -96.3149 | (19.2818, -96.314899999999994) | Landslide | Landslide | Medium | Tropical cyclone | Hurricane Karl | NA | 2 | http://www.lfpress.com/news/world/2010/09/17/15382976-reuters.html | 25.6489542 | 72.055113 |
stem(df_vl$"Distance")
##
## The decimal point is at the |
##
## 0 | 1535
## 2 | 97
## 4 | 5
## 6 |
## 8 | 35
stem(df_vl$"Distance", scale = 2)
##
## The decimal point is at the |
##
## 0 | 15
## 1 | 35
## 2 | 9
## 3 | 7
## 4 | 5
## 5 |
## 6 |
## 7 |
## 8 | 3
## 9 | 5
library(forecast)
data<- ts(df_vl$Distance, frequency=12, start=2008)
knitr::kable(head(data))
| x |
|---|
| 3.73160 |
| 1.27837 |
| 4.51820 |
| 9.51003 |
| 0.09971 |
| 8.28739 |
autoplot(data) + labs(title = "Gráfico de series temporales", x="date", y = "distancia", colour = "green") +theme_bw()
library(questionr)
table <- questionr::freq(Distance, cum = TRUE, sort = "dec", total = TRUE)
knitr::kable(table)
| n | % | val% | %cum | val%cum | |
|---|---|---|---|---|---|
| 0.09971 | 1 | 11.1 | 11.1 | 11.1 | 11.1 |
| 0.50188 | 1 | 11.1 | 11.1 | 22.2 | 22.2 |
| 1.27837 | 1 | 11.1 | 11.1 | 33.3 | 33.3 |
| 1.52983 | 1 | 11.1 | 11.1 | 44.4 | 44.4 |
| 2.85382 | 1 | 11.1 | 11.1 | 55.6 | 55.6 |
| 3.7316 | 1 | 11.1 | 11.1 | 66.7 | 66.7 |
| 4.5182 | 1 | 11.1 | 11.1 | 77.8 | 77.8 |
| 8.28739 | 1 | 11.1 | 11.1 | 88.9 | 88.9 |
| 9.51003 | 1 | 11.1 | 11.1 | 100.0 | 100.0 |
| Total | 9 | 100.0 | 100.0 | 100.0 | 100.0 |
str(table)
## Classes 'freqtab' and 'data.frame': 10 obs. of 5 variables:
## $ n : num 1 1 1 1 1 1 1 1 1 9
## $ % : num 11.1 11.1 11.1 11.1 11.1 11.1 11.1 11.1 11.1 100
## $ val% : num 11.1 11.1 11.1 11.1 11.1 11.1 11.1 11.1 11.1 100
## $ %cum : num 11.1 22.2 33.3 44.4 55.6 66.7 77.8 88.9 100 100
## $ val%cum: num 11.1 22.2 33.3 44.4 55.6 66.7 77.8 88.9 100 100
x <- row.names(table)
y <- table$n
names <- x[1:(length(x)-1)]
freqs <- y[1:(length(y)-1)]
df_vl <- data.frame(x = names, y = freqs)
knitr::kable(df_vl)
| x | y |
|---|---|
| 0.09971 | 1 |
| 0.50188 | 1 |
| 1.27837 | 1 |
| 1.52983 | 1 |
| 2.85382 | 1 |
| 3.7316 | 1 |
| 4.5182 | 1 |
| 8.28739 | 1 |
| 9.51003 | 1 |
library(ggplot2)
ggplot(data=df_vl, aes(x=x, y=y)) +
geom_bar(stat="identity", color="white", fill="blue") +
xlab("Rango de deslizamiento") +
ylab("Frecuencia")
n_sturges = 1 + log(length(Distance))/log(2)
n_sturgesc = ceiling(n_sturges)
n_sturgesf = floor(n_sturges)
n_clases = 0
if (n_sturgesc%%2 == 0) {
n_clases = n_sturgesf
} else {
n_clases = n_sturgesc
}
R = max(Distance) - min(Distance)
w = ceiling(R/n_clases)
bins <- seq(min(Distance), max(Distance) + w, by = w)
bins
## [1] 0.09971 2.09971 4.09971 6.09971 8.09971 10.09971
Edades <- cut(Distance, bins)
Freq_table <- transform(table(Distance), Rel_Freq=prop.table(Freq), Cum_Freq=cumsum(Freq))
knitr::kable(Freq_table)
| Distance | Freq | Rel_Freq | Cum_Freq |
|---|---|---|---|
| 0.09971 | 1 | 0.1111111 | 1 |
| 0.50188 | 1 | 0.1111111 | 2 |
| 1.27837 | 1 | 0.1111111 | 3 |
| 1.52983 | 1 | 0.1111111 | 4 |
| 2.85382 | 1 | 0.1111111 | 5 |
| 3.7316 | 1 | 0.1111111 | 6 |
| 4.5182 | 1 | 0.1111111 | 7 |
| 8.28739 | 1 | 0.1111111 | 8 |
| 9.51003 | 1 | 0.1111111 | 9 |
str(Freq_table)
## 'data.frame': 9 obs. of 4 variables:
## $ Distance: Factor w/ 9 levels "0.09971","0.50188",..: 1 2 3 4 5 6 7 8 9
## $ Freq : int 1 1 1 1 1 1 1 1 1
## $ Rel_Freq: num 0.111 0.111 0.111 0.111 0.111 ...
## $ Cum_Freq: int 1 2 3 4 5 6 7 8 9
df_vl <- data.frame(x = Freq_table$Distance, y = Freq_table$Freq)
knitr::kable(df_vl)
| x | y |
|---|---|
| 0.09971 | 1 |
| 0.50188 | 1 |
| 1.27837 | 1 |
| 1.52983 | 1 |
| 2.85382 | 1 |
| 3.7316 | 1 |
| 4.5182 | 1 |
| 8.28739 | 1 |
| 9.51003 | 1 |
library(ggplot2)
ggplot(data=df_vl, aes(x=x, y=y)) +
geom_bar(stat="identity", color="blue", fill="green") +
xlab("Rango de Distance") +
ylab("Frecuencia")
Estos se encargan de la toma de datos cuantitativa con respecto a la información proporcionada, los datos se calculan a partir de la media, mediana, moda, cuartiles etc.
summary(df_vl$Distance)
## Length Class Mode
## 0 NULL NULL
library(pastecs)
stat.desc(df_vl)
## x y
## nbr.val NA 9
## nbr.null NA 0
## nbr.na NA 0
## min NA 1
## max NA 1
## range NA 0
## sum NA 9
## median NA 1
## mean NA 1
## SE.mean NA 0
## CI.mean NA 0
## var NA 0
## std.dev NA 0
## coef.var NA 0
boxplot(Distance, horizontal=TRUE, col='steelblue')
library(readr)
library(knitr)
df_mx <- subset (df, Country == "Mexico")
knitr::kable(head(df_mx))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 13 | 115 | 7/4/07 | NA | Mexico | MX | Veracruz-Llave | 1947 | Laguna Chica (Pueblo Nuevo) | 9.51003 | 18.5369 | -96.8229 | (18.536899999999999, -96.822900000000004) | Landslide | Landslide | Medium | Rain | NA | 7 | nytimes.com | http://www.nytimes.com/2007/07/04/world/americas/04cnd-mexico.html?_r=1&hp&oref=slogin | |||
| 29 | 201 | 8/23/07 | NA | Mexico | MX | Puebla | 1414 | Xochitlaxco (San Baltazar) | 1.68294 | 19.9333 | -97.8500 | (19.933299999999999, -97.85) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Dean | NA | 6 | Inquirer.com | http://newsinfo.inquirer.net/breakingnews/world/view_article.php?article_id=84452 | ||
| 31 | 225 | 9/2/07 | NA | Mexico | MX | Sinaloa | 3191 | El Limón de los Ramos | 10.88351 | 24.9531 | -107.6220 | (24.953099999999999, -107.622) | Landslide | Complex | Medium | Tropical cyclone | Tropical Storm Henrietta | NA | 3 | ||||
| 42 | 284 | 9/28/07 | NA | Mexico | MX | Puebla | 3761 | Xaltepuxtla | 7.93258 | 20.2000 | -97.9000 | (20.2, -97.9) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Lorenzo | NA | 1 | PressTV.ir | http://www.presstv.ir/detail.aspx?id=25037§ionid=3510207 | ||
| 57 | 342 | 10/31/07 | NA | Mexico | MX | Tabasco | 4468 | Buenavista | 4.19108 | 17.9493 | -92.5534 | (17.949300000000001, -92.553399999999996) | Landslide | Landslide | Medium | Rain | NA | 18 | CapeTimes | http://www.capetimes.co.za/?fArticleId=4109453 | |||
| 59 | 346 | 11/4/07 | NA | Mexico | MX | Chiapas | 3183 | Ostuacán | 3.74149 | 17.3900 | -93.3060 | (17.39, -93.305999999999997) | Landslide | Mudslide | Very_large | Rain | NA | 5 | Reuters - AlertNet.org | http://news.monstersandcritics.com/americas/news/article_1371436.php/Mudslide_is_latest_disaster_for_hard-hit_Mexico__2nd_Roundup_ |
library(readr)
library(knitr)
df_pue <- subset (df, State == "Puebla")
df_pue %>%
select(Country, State, City, Distance)
## Country State City Distance
## 29 Mexico Puebla Xochitlaxco (San Baltazar) 1.68294
## 42 Mexico Puebla Xaltepuxtla 7.93258
## 1149 Mexico Puebla Tlatlauquitepec 0.30326
## 1155 Mexico Puebla Atzala 5.24855
library(ggplot2)
ggplot(data=df_pue, aes(x= State , y= Distance)) + geom_bar(stat="identity", color="black", fill="red")
library(ggplot2)
library(dplyr)
ggplot(data=df_pue, aes(fill=City, x="Puebla", y=Distance)) +
geom_bar(position="dodge", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_pue, aes(fill=City, x="Puebla", y=Distance)) +
geom_bar(position="stack", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_pue, aes(x = "Puebla", y = Distance , fill=City)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y", start = 0)
library(qcc)
Distance <- df_pue$Distance
names(Distance) <- df_pue$City
pareto.chart(Distance,
ylab="Distance",
col = heat.colors(length(Distance)),
cumperc = seq(0, 100, by = 10),
ylab2 = "Porcentaje acumulado",
main = "DONDE SE CONCENTRAN LAS CIUDADES CON MAYORES DESLIZAMIENTOS")
##
## Pareto chart analysis for Distance
## Frequency Cum.Freq. Percentage Cum.Percent.
## Xaltepuxtla 7.932580 7.932580 52.300438 52.300438
## Atzala 5.248550 13.181130 34.604311 86.904749
## Xochitlaxco (San Baltazar) 1.682940 14.864070 11.095822 98.000571
## Tlatlauquitepec 0.303260 15.167330 1.999429 100.000000
stem(df_pue$"Distance")
##
## The decimal point is at the |
##
## 0 | 37
## 2 |
## 4 | 2
## 6 | 9
head(df_pue)
## id date time continent_code Country country_code State population
## 29 201 8/23/07 <NA> Mexico MX Puebla 1414
## 42 284 9/28/07 <NA> Mexico MX Puebla 3761
## 1149 5528 9/15/13 <NA> Mexico MX Puebla 9720
## 1155 5539 9/16/13 <NA> Mexico MX Puebla 1123
## City Distance location_description latitude
## 29 Xochitlaxco (San Baltazar) 1.68294 19.9333
## 42 Xaltepuxtla 7.93258 20.2000
## 1149 Tlatlauquitepec 0.30326 19.8490
## 1155 Atzala 5.24855 18.5938
## longitude geolocation hazard_type
## 29 -97.8500 (19.933299999999999, -97.85) Landslide
## 42 -97.9000 (20.2, -97.9) Landslide
## 1149 -97.4997 (19.849, -97.499700000000004) Landslide
## 1155 -98.5539 (18.593800000000002, -98.553899999999999) Landslide
## landslide_type landslide_size trigger storm_name injuries
## 29 Mudslide Medium Tropical cyclone Hurricane Dean NA
## 42 Mudslide Medium Tropical cyclone Hurricane Lorenzo NA
## 1149 Landslide Very_large Tropical cyclone Ingrid 1
## 1155 Landslide Medium Tropical cyclone Manyi NA
## fatalities source_name
## 29 6 Inquirer.com
## 42 1 PressTV.ir
## 1149 3 www.recordonline.com
## 1155 0 america.aljazeera.com
## source_link
## 29 http://newsinfo.inquirer.net/breakingnews/world/view_article.php?article_id=84452
## 42 http://www.presstv.ir/detail.aspx?id=25037§ionid=3510207
## 1149 http://www.recordonline.com/apps/pbcs.dll/article?AID=/20130915/NEWS/130919814/-1/SITEMAP
## 1155 http://america.aljazeera.com/articles/2013/11/19/after-landslide-poorestofthepoorleftoutinthecoldinmexico.html
knitr::kable(head(df_pue))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 29 | 201 | 8/23/07 | NA | Mexico | MX | Puebla | 1414 | Xochitlaxco (San Baltazar) | 1.68294 | 19.9333 | -97.8500 | (19.933299999999999, -97.85) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Dean | NA | 6 | Inquirer.com | http://newsinfo.inquirer.net/breakingnews/world/view_article.php?article_id=84452 | ||
| 42 | 284 | 9/28/07 | NA | Mexico | MX | Puebla | 3761 | Xaltepuxtla | 7.93258 | 20.2000 | -97.9000 | (20.2, -97.9) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Lorenzo | NA | 1 | PressTV.ir | http://www.presstv.ir/detail.aspx?id=25037§ionid=3510207 | ||
| 1149 | 5528 | 9/15/13 | NA | Mexico | MX | Puebla | 9720 | Tlatlauquitepec | 0.30326 | 19.8490 | -97.4997 | (19.849, -97.499700000000004) | Landslide | Landslide | Very_large | Tropical cyclone | Ingrid | 1 | 3 | www.recordonline.com | http://www.recordonline.com/apps/pbcs.dll/article?AID=/20130915/NEWS/130919814/-1/SITEMAP | ||
| 1155 | 5539 | 9/16/13 | NA | Mexico | MX | Puebla | 1123 | Atzala | 5.24855 | 18.5938 | -98.5539 | (18.593800000000002, -98.553899999999999) | Landslide | Landslide | Medium | Tropical cyclone | Manyi | NA | 0 | america.aljazeera.com | http://america.aljazeera.com/articles/2013/11/19/after-landslide-poorestofthepoorleftoutinthecoldinmexico.html |
stem(df_pue$"Distance")
##
## The decimal point is at the |
##
## 0 | 37
## 2 |
## 4 | 2
## 6 | 9
stem(df_pue$"Distance", scale = 2)
##
## The decimal point is at the |
##
## 0 | 3
## 1 | 7
## 2 |
## 3 |
## 4 |
## 5 | 2
## 6 |
## 7 | 9
library(forecast)
data<- ts(df_pue$Distance, frequency=12, start=2008)
knitr::kable(head(data))
| x |
|---|
| 1.68294 |
| 7.93258 |
| 0.30326 |
| 5.24855 |
autoplot(data) + labs(title = "Gráfico de series temporales", x="date", y = "distancia", colour = "green") +theme_bw()
library(questionr)
table <- questionr::freq(Distance, cum = TRUE, sort = "dec", total = TRUE)
knitr::kable(table)
| n | % | val% | %cum | val%cum | |
|---|---|---|---|---|---|
| 0.30326 | 1 | 25 | 25 | 25 | 25 |
| 1.68294 | 1 | 25 | 25 | 50 | 50 |
| 5.24855 | 1 | 25 | 25 | 75 | 75 |
| 7.93258 | 1 | 25 | 25 | 100 | 100 |
| Total | 4 | 100 | 100 | 100 | 100 |
str(table)
## Classes 'freqtab' and 'data.frame': 5 obs. of 5 variables:
## $ n : num 1 1 1 1 4
## $ % : num 25 25 25 25 100
## $ val% : num 25 25 25 25 100
## $ %cum : num 25 50 75 100 100
## $ val%cum: num 25 50 75 100 100
x <- row.names(table)
y <- table$n
names <- x[1:(length(x)-1)]
freqs <- y[1:(length(y)-1)]
df_pue <- data.frame(x = names, y = freqs)
knitr::kable(df_pue)
| x | y |
|---|---|
| 0.30326 | 1 |
| 1.68294 | 1 |
| 5.24855 | 1 |
| 7.93258 | 1 |
library(ggplot2)
ggplot(data=df_pue, aes(x=x, y=y)) +
geom_bar(stat="identity", color="white", fill="blue") +
xlab("Rango de deslizamiento") +
ylab("Frecuencia")
n_sturges = 1 + log(length(Distance))/log(2)
n_sturgesc = ceiling(n_sturges)
n_sturgesf = floor(n_sturges)
n_clases = 0
if (n_sturgesc%%2 == 0) {
n_clases = n_sturgesf
} else {
n_clases = n_sturgesc
}
R = max(Distance) - min(Distance)
w = ceiling(R/n_clases)
bins <- seq(min(Distance), max(Distance) + w, by = w)
bins
## [1] 0.30326 3.30326 6.30326 9.30326
Edades <- cut(Distance, bins)
Freq_table <- transform(table(Distance), Rel_Freq=prop.table(Freq), Cum_Freq=cumsum(Freq))
knitr::kable(Freq_table)
| Distance | Freq | Rel_Freq | Cum_Freq |
|---|---|---|---|
| 0.30326 | 1 | 0.25 | 1 |
| 1.68294 | 1 | 0.25 | 2 |
| 5.24855 | 1 | 0.25 | 3 |
| 7.93258 | 1 | 0.25 | 4 |
str(Freq_table)
## 'data.frame': 4 obs. of 4 variables:
## $ Distance: Factor w/ 4 levels "0.30326","1.68294",..: 1 2 3 4
## $ Freq : int 1 1 1 1
## $ Rel_Freq: num 0.25 0.25 0.25 0.25
## $ Cum_Freq: int 1 2 3 4
df_pue <- data.frame(x = Freq_table$Distance, y = Freq_table$Freq)
knitr::kable(df_pue)
| x | y |
|---|---|
| 0.30326 | 1 |
| 1.68294 | 1 |
| 5.24855 | 1 |
| 7.93258 | 1 |
library(ggplot2)
ggplot(data=df_pue, aes(x=x, y=y)) +
geom_bar(stat="identity", color="blue", fill="green") +
xlab("Rango de Distance") +
ylab("Frecuencia")
Estos se encargan de la toma de datos cuantitativa con respecto a la información proporcionada, los datos se calculan a partir de la media, mediana, moda, cuartiles etc.
summary(df_pue$Distance)
## Length Class Mode
## 0 NULL NULL
library(pastecs)
stat.desc(df_pue)
## x y
## nbr.val NA 4
## nbr.null NA 0
## nbr.na NA 0
## min NA 1
## max NA 1
## range NA 0
## sum NA 4
## median NA 1
## mean NA 1
## SE.mean NA 0
## CI.mean NA 0
## var NA 0
## std.dev NA 0
## coef.var NA 0
boxplot(Distance, horizontal=TRUE, col='steelblue')
library(readr)
library(knitr)
df_mx <- subset (df, Country == "Mexico")
knitr::kable(head(df_mx))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 13 | 115 | 7/4/07 | NA | Mexico | MX | Veracruz-Llave | 1947 | Laguna Chica (Pueblo Nuevo) | 9.51003 | 18.5369 | -96.8229 | (18.536899999999999, -96.822900000000004) | Landslide | Landslide | Medium | Rain | NA | 7 | nytimes.com | http://www.nytimes.com/2007/07/04/world/americas/04cnd-mexico.html?_r=1&hp&oref=slogin | |||
| 29 | 201 | 8/23/07 | NA | Mexico | MX | Puebla | 1414 | Xochitlaxco (San Baltazar) | 1.68294 | 19.9333 | -97.8500 | (19.933299999999999, -97.85) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Dean | NA | 6 | Inquirer.com | http://newsinfo.inquirer.net/breakingnews/world/view_article.php?article_id=84452 | ||
| 31 | 225 | 9/2/07 | NA | Mexico | MX | Sinaloa | 3191 | El Limón de los Ramos | 10.88351 | 24.9531 | -107.6220 | (24.953099999999999, -107.622) | Landslide | Complex | Medium | Tropical cyclone | Tropical Storm Henrietta | NA | 3 | ||||
| 42 | 284 | 9/28/07 | NA | Mexico | MX | Puebla | 3761 | Xaltepuxtla | 7.93258 | 20.2000 | -97.9000 | (20.2, -97.9) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Lorenzo | NA | 1 | PressTV.ir | http://www.presstv.ir/detail.aspx?id=25037§ionid=3510207 | ||
| 57 | 342 | 10/31/07 | NA | Mexico | MX | Tabasco | 4468 | Buenavista | 4.19108 | 17.9493 | -92.5534 | (17.949300000000001, -92.553399999999996) | Landslide | Landslide | Medium | Rain | NA | 18 | CapeTimes | http://www.capetimes.co.za/?fArticleId=4109453 | |||
| 59 | 346 | 11/4/07 | NA | Mexico | MX | Chiapas | 3183 | Ostuacán | 3.74149 | 17.3900 | -93.3060 | (17.39, -93.305999999999997) | Landslide | Mudslide | Very_large | Rain | NA | 5 | Reuters - AlertNet.org | http://news.monstersandcritics.com/americas/news/article_1371436.php/Mudslide_is_latest_disaster_for_hard-hit_Mexico__2nd_Roundup_ |
library(readr)
library(knitr)
df_tb <- subset (df, State == "Tabasco")
df_tb %>%
select(Country, State, City, Distance)
## Country State City Distance
## 57 Mexico Tabasco Buenavista 4.19108
## 1185 Mexico Tabasco Olcuatitán 4.32007
## 1586 Mexico Tabasco Libertad 4.81680
## 1587 Mexico Tabasco Huapinol 2.15703
## 1625 Mexico Tabasco Olcuatitán 8.93271
## 1674 Mexico Tabasco Tenosique de Pino Suárez 15.22260
library(ggplot2)
ggplot(data=df_tb, aes(x= State , y= Distance)) + geom_bar(stat="identity", color="black", fill="red")
library(ggplot2)
library(dplyr)
ggplot(data=df_tb, aes(fill=City, x="Tabasco", y=Distance)) +
geom_bar(position="dodge", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_tb, aes(fill=City, x="Tabasco", y=Distance)) +
geom_bar(position="stack", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_tb, aes(x = "Tabasco", y = Distance , fill=City)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y", start = 0)
library(ggplot2)
library(dplyr)
df_tb <- df_tb %>%
arrange(desc(City)) %>%
mutate(prop = Distance / sum(df_tb$Distance) *100) %>%
mutate(ypos = cumsum(prop)- 0.5*prop )
require(scales)
ggplot(df_tb, aes(x= State, y = prop, fill=City)) +
geom_bar(stat="identity", width=1, color="black") +
coord_polar("y", start=0) +
theme_void() +
theme(legend.position="none") +
geom_text(aes(y = ypos, label = percent(prop/100)), color = "black", size=3) +
scale_fill_brewer(palette="Set4")
## Warning in pal_name(palette, type): Unknown palette Set4
library(qcc)
Distance <- df_tb$Distance
names(Distance) <- df_tb$City
pareto.chart(Distance,
ylab="Distance",
col = heat.colors(length(Distance)),
cumperc = seq(0, 100, by = 10),
ylab2 = "Porcentaje acumulado",
main = "DONDE SE CONCENTRAN LAS CIUDADES CON MAYORES DESLIZAMIENTOS")
##
## Pareto chart analysis for Distance
## Frequency Cum.Freq. Percentage Cum.Percent.
## Tenosique de Pino Suárez 15.222600 15.222600 38.401838 38.401838
## Olcuatitán 8.932710 24.155310 22.534421 60.936260
## Libertad 4.816800 28.972110 12.151273 73.087533
## Olcuatitán 4.320070 33.292180 10.898180 83.985713
## Buenavista 4.191080 37.483260 10.572778 94.558491
## Huapinol 2.157030 39.640290 5.441509 100.000000
stem(df_tb$"Distance")
##
## The decimal point is 1 digit(s) to the right of the |
##
## 0 | 244
## 0 | 59
## 1 |
## 1 | 5
head(df_tb)
## id date time continent_code Country country_code State population
## 1 7518 10/15/15 <NA> Mexico MX Tabasco 32415
## 2 5693 12/16/13 <NA> Mexico MX Tabasco 1732
## 3 7469 12/16/15 <NA> Mexico MX Tabasco 1732
## 4 7430 10/7/15 <NA> Mexico MX Tabasco 1042
## 5 7431 10/7/15 <NA> Mexico MX Tabasco 2500
## 6 342 10/31/07 <NA> Mexico MX Tabasco 4468
## City Distance location_description latitude longitude
## 1 Tenosique de Pino Suárez 15.22260 Below road 17.4054 -91.2988
## 2 Olcuatitán 4.32007 18.1563 -92.9790
## 3 Olcuatitán 8.93271 Below road 18.2341 -92.8901
## 4 Libertad 4.81680 Unknown 17.3768 -92.7439
## 5 Huapinol 2.15703 Unknown 17.9100 -92.8956
## 6 Buenavista 4.19108 17.9493 -92.5534
## geolocation hazard_type landslide_type
## 1 (17.4054, -91.2988) Landslide Landslide
## 2 (18.156300000000002, -92.978999999999999) Landslide Landslide
## 3 (18.234100000000002, -92.890100000000004) Landslide Riverbank collapse
## 4 (17.376799999999999, -92.743899999999996) Landslide Landslide
## 5 (17.91, -92.895600000000002) Landslide Landslide
## 6 (17.949300000000001, -92.553399999999996) Landslide Landslide
## landslide_size trigger storm_name injuries fatalities
## 1 Medium Flooding 0 0
## 2 Medium Continuous rain NA NA
## 3 Medium Flooding 0 0
## 4 Medium Rain 0 0
## 5 Medium Rain 0 0
## 6 Medium Rain NA 18
## source_name
## 1 ver tiente global
## 2 www.aljazeera.com
## 3 Diario Presente
## 4 Tabasco Hoy
## 5 Tabasco Hoy
## 6 CapeTimes
## source_link
## 1 http://vertienteglobal.com/?p=49401
## 2 http://www.aljazeera.com/weather/2013/12/rain-snow-floods-hit-mexico-20131229105245837299.html
## 3 http://www.diariopresente.com.mx/noticia/tabasco/145872/deslave-carretera-punto-dejar-incomunicados-comunidades-nacajuca/
## 4 http://www.tabascohoy.com/2/notas/273505/dejan-lluvias-deslizamientos-e-inundaciones-en-la-sierra
## 5 http://www.tabascohoy.com/2/notas/273505/dejan-lluvias-deslizamientos-e-inundaciones-en-la-sierra
## 6 http://www.capetimes.co.za/?fArticleId=4109453
## prop ypos
## 1 38.401838 19.20092
## 2 10.898180 43.85093
## 3 22.534421 60.56723
## 4 12.151273 77.91008
## 5 5.441509 86.70647
## 6 10.572778 94.71361
knitr::kable(head(df_tb))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | prop | ypos |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 7518 | 10/15/15 | NA | Mexico | MX | Tabasco | 32415 | Tenosique de Pino Suárez | 15.22260 | Below road | 17.4054 | -91.2988 | (17.4054, -91.2988) | Landslide | Landslide | Medium | Flooding | 0 | 0 | ver tiente global | http://vertienteglobal.com/?p=49401 | 38.401838 | 19.20092 | ||
| 5693 | 12/16/13 | NA | Mexico | MX | Tabasco | 1732 | Olcuatitán | 4.32007 | 18.1563 | -92.9790 | (18.156300000000002, -92.978999999999999) | Landslide | Landslide | Medium | Continuous rain | NA | NA | www.aljazeera.com | http://www.aljazeera.com/weather/2013/12/rain-snow-floods-hit-mexico-20131229105245837299.html | 10.898180 | 43.85093 | |||
| 7469 | 12/16/15 | NA | Mexico | MX | Tabasco | 1732 | Olcuatitán | 8.93271 | Below road | 18.2341 | -92.8901 | (18.234100000000002, -92.890100000000004) | Landslide | Riverbank collapse | Medium | Flooding | 0 | 0 | Diario Presente | http://www.diariopresente.com.mx/noticia/tabasco/145872/deslave-carretera-punto-dejar-incomunicados-comunidades-nacajuca/ | 22.534421 | 60.56723 | ||
| 7430 | 10/7/15 | NA | Mexico | MX | Tabasco | 1042 | Libertad | 4.81680 | Unknown | 17.3768 | -92.7439 | (17.376799999999999, -92.743899999999996) | Landslide | Landslide | Medium | Rain | 0 | 0 | Tabasco Hoy | http://www.tabascohoy.com/2/notas/273505/dejan-lluvias-deslizamientos-e-inundaciones-en-la-sierra | 12.151273 | 77.91008 | ||
| 7431 | 10/7/15 | NA | Mexico | MX | Tabasco | 2500 | Huapinol | 2.15703 | Unknown | 17.9100 | -92.8956 | (17.91, -92.895600000000002) | Landslide | Landslide | Medium | Rain | 0 | 0 | Tabasco Hoy | http://www.tabascohoy.com/2/notas/273505/dejan-lluvias-deslizamientos-e-inundaciones-en-la-sierra | 5.441509 | 86.70647 | ||
| 342 | 10/31/07 | NA | Mexico | MX | Tabasco | 4468 | Buenavista | 4.19108 | 17.9493 | -92.5534 | (17.949300000000001, -92.553399999999996) | Landslide | Landslide | Medium | Rain | NA | 18 | CapeTimes | http://www.capetimes.co.za/?fArticleId=4109453 | 10.572778 | 94.71361 |
stem(df_tb$"Distance")
##
## The decimal point is 1 digit(s) to the right of the |
##
## 0 | 244
## 0 | 59
## 1 |
## 1 | 5
stem(df_tb$"Distance", scale = 2)
##
## The decimal point is at the |
##
## 2 | 2
## 4 | 238
## 6 |
## 8 | 9
## 10 |
## 12 |
## 14 | 2
library(forecast)
data<- ts(df_tb$Distance, frequency=12, start=2008)
knitr::kable(head(data))
| x |
|---|
| 15.22260 |
| 4.32007 |
| 8.93271 |
| 4.81680 |
| 2.15703 |
| 4.19108 |
autoplot(data) + labs(title = "Gráfico de series temporales", x="date", y = "distancia", colour = "green") +theme_bw()
library(questionr)
table <- questionr::freq(Distance, cum = TRUE, sort = "dec", total = TRUE)
knitr::kable(table)
| n | % | val% | %cum | val%cum | |
|---|---|---|---|---|---|
| 2.15703 | 1 | 16.7 | 16.7 | 16.7 | 16.7 |
| 4.19108 | 1 | 16.7 | 16.7 | 33.3 | 33.3 |
| 4.32007 | 1 | 16.7 | 16.7 | 50.0 | 50.0 |
| 4.8168 | 1 | 16.7 | 16.7 | 66.7 | 66.7 |
| 8.93271 | 1 | 16.7 | 16.7 | 83.3 | 83.3 |
| 15.2226 | 1 | 16.7 | 16.7 | 100.0 | 100.0 |
| Total | 6 | 100.0 | 100.0 | 100.0 | 100.0 |
str(table)
## Classes 'freqtab' and 'data.frame': 7 obs. of 5 variables:
## $ n : num 1 1 1 1 1 1 6
## $ % : num 16.7 16.7 16.7 16.7 16.7 16.7 100
## $ val% : num 16.7 16.7 16.7 16.7 16.7 16.7 100
## $ %cum : num 16.7 33.3 50 66.7 83.3 100 100
## $ val%cum: num 16.7 33.3 50 66.7 83.3 100 100
x <- row.names(table)
y <- table$n
names <- x[1:(length(x)-1)]
freqs <- y[1:(length(y)-1)]
df_tb <- data.frame(x = names, y = freqs)
knitr::kable(df_tb)
| x | y |
|---|---|
| 2.15703 | 1 |
| 4.19108 | 1 |
| 4.32007 | 1 |
| 4.8168 | 1 |
| 8.93271 | 1 |
| 15.2226 | 1 |
library(ggplot2)
ggplot(data=df_tb, aes(x=x, y=y)) +
geom_bar(stat="identity", color="white", fill="blue") +
xlab("Rango de deslizamiento") +
ylab("Frecuencia")
n_sturges = 1 + log(length(Distance))/log(2)
n_sturgesc = ceiling(n_sturges)
n_sturgesf = floor(n_sturges)
n_clases = 0
if (n_sturgesc%%2 == 0) {
n_clases = n_sturgesf
} else {
n_clases = n_sturgesc
}
R = max(Distance) - min(Distance)
w = ceiling(R/n_clases)
bins <- seq(min(Distance), max(Distance) + w, by = w)
bins
## [1] 2.15703 7.15703 12.15703 17.15703
Edades <- cut(Distance, bins)
Freq_table <- transform(table(Distance), Rel_Freq=prop.table(Freq), Cum_Freq=cumsum(Freq))
knitr::kable(Freq_table)
| Distance | Freq | Rel_Freq | Cum_Freq |
|---|---|---|---|
| 2.15703 | 1 | 0.1666667 | 1 |
| 4.19108 | 1 | 0.1666667 | 2 |
| 4.32007 | 1 | 0.1666667 | 3 |
| 4.8168 | 1 | 0.1666667 | 4 |
| 8.93271 | 1 | 0.1666667 | 5 |
| 15.2226 | 1 | 0.1666667 | 6 |
str(Freq_table)
## 'data.frame': 6 obs. of 4 variables:
## $ Distance: Factor w/ 6 levels "2.15703","4.19108",..: 1 2 3 4 5 6
## $ Freq : int 1 1 1 1 1 1
## $ Rel_Freq: num 0.167 0.167 0.167 0.167 0.167 ...
## $ Cum_Freq: int 1 2 3 4 5 6
df_tb <- data.frame(x = Freq_table$Distance, y = Freq_table$Freq)
knitr::kable(df_tb)
| x | y |
|---|---|
| 2.15703 | 1 |
| 4.19108 | 1 |
| 4.32007 | 1 |
| 4.8168 | 1 |
| 8.93271 | 1 |
| 15.2226 | 1 |
library(ggplot2)
ggplot(data=df_tb, aes(x=x, y=y)) +
geom_bar(stat="identity", color="blue", fill="green") +
xlab("Rango de Distance") +
ylab("Frecuencia")
Estos se encargan de la toma de datos cuantitativa con respecto a la información proporcionada, los datos se calculan a partir de la media, mediana, moda, cuartiles etc.
summary(df_tb$Distance)
## Length Class Mode
## 0 NULL NULL
library(pastecs)
stat.desc(df_tb)
## x y
## nbr.val NA 6
## nbr.null NA 0
## nbr.na NA 0
## min NA 1
## max NA 1
## range NA 0
## sum NA 6
## median NA 1
## mean NA 1
## SE.mean NA 0
## CI.mean NA 0
## var NA 0
## std.dev NA 0
## coef.var NA 0
boxplot(Distance, horizontal=TRUE, col='steelblue')
library(readr)
library(knitr)
df_mx <- subset (df, Country == "Mexico")
knitr::kable(head(df_mx))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 13 | 115 | 7/4/07 | NA | Mexico | MX | Veracruz-Llave | 1947 | Laguna Chica (Pueblo Nuevo) | 9.51003 | 18.5369 | -96.8229 | (18.536899999999999, -96.822900000000004) | Landslide | Landslide | Medium | Rain | NA | 7 | nytimes.com | http://www.nytimes.com/2007/07/04/world/americas/04cnd-mexico.html?_r=1&hp&oref=slogin | |||
| 29 | 201 | 8/23/07 | NA | Mexico | MX | Puebla | 1414 | Xochitlaxco (San Baltazar) | 1.68294 | 19.9333 | -97.8500 | (19.933299999999999, -97.85) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Dean | NA | 6 | Inquirer.com | http://newsinfo.inquirer.net/breakingnews/world/view_article.php?article_id=84452 | ||
| 31 | 225 | 9/2/07 | NA | Mexico | MX | Sinaloa | 3191 | El Limón de los Ramos | 10.88351 | 24.9531 | -107.6220 | (24.953099999999999, -107.622) | Landslide | Complex | Medium | Tropical cyclone | Tropical Storm Henrietta | NA | 3 | ||||
| 42 | 284 | 9/28/07 | NA | Mexico | MX | Puebla | 3761 | Xaltepuxtla | 7.93258 | 20.2000 | -97.9000 | (20.2, -97.9) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Lorenzo | NA | 1 | PressTV.ir | http://www.presstv.ir/detail.aspx?id=25037§ionid=3510207 | ||
| 57 | 342 | 10/31/07 | NA | Mexico | MX | Tabasco | 4468 | Buenavista | 4.19108 | 17.9493 | -92.5534 | (17.949300000000001, -92.553399999999996) | Landslide | Landslide | Medium | Rain | NA | 18 | CapeTimes | http://www.capetimes.co.za/?fArticleId=4109453 | |||
| 59 | 346 | 11/4/07 | NA | Mexico | MX | Chiapas | 3183 | Ostuacán | 3.74149 | 17.3900 | -93.3060 | (17.39, -93.305999999999997) | Landslide | Mudslide | Very_large | Rain | NA | 5 | Reuters - AlertNet.org | http://news.monstersandcritics.com/americas/news/article_1371436.php/Mudslide_is_latest_disaster_for_hard-hit_Mexico__2nd_Roundup_ |
library(readr)
library(knitr)
df_chi <- subset (df, State == "Chiapas")
df_chi %>%
select(Country, State, City, Distance)
## Country State City Distance
## 59 Mexico Chiapas Ostuacán 3.74149
## 385 Mexico Chiapas Escuintla 1.41805
## 386 Mexico Chiapas San Cristóbal de las Casas 0.94118
## 463 Mexico Chiapas Amatán 0.31118
## 464 Mexico Chiapas Chihuahua 8.46579
## 798 Mexico Chiapas Nueva Libertad 7.93996
## 1670 Mexico Chiapas Santo Domingo 0.76257
## 1671 Mexico Chiapas Motozintla de Mendoza 2.06743
## 1672 Mexico Chiapas Emiliano Zapata 4.68443
## 1673 Mexico Chiapas Tila 1.73469
library(ggplot2)
ggplot(data=df_chi, aes(x= State , y= Distance)) + geom_bar(stat="identity", color="black", fill="brown")
library(ggplot2)
library(dplyr)
ggplot(data=df_chi, aes(fill=City, x="Chiapas", y=Distance)) +
geom_bar(position="dodge", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_chi, aes(fill=City, x="Chiapas", y=Distance)) +
geom_bar(position="stack", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_chi, aes(x = "Chiapas", y = Distance , fill=City)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y", start = 0)
library(ggplot2)
library(dplyr)
df_chi <- df_chi %>%
arrange(desc(City)) %>%
mutate(prop = Distance / sum(df_chi$Distance) *100) %>%
mutate(ypos = cumsum(prop)- 0.5*prop )
require(scales)
ggplot(df_chi, aes(x= State, y = prop, fill=City)) +
geom_bar(stat="identity", width=1, color="black") +
coord_polar("y", start=0) +
theme_void() +
theme(legend.position="none") +
geom_text(aes(y = ypos, label = percent(prop/100)), color = "black", size=3) +
scale_fill_brewer(palette="Set4")
## Warning in pal_name(palette, type): Unknown palette Set4
## Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Greens is 9
## Returning the palette you asked for with that many colors
library(qcc)
Distance <- df_chi$Distance
names(Distance) <- df_chi$City
pareto.chart(Distance,
ylab="Distance",
col = heat.colors(length(Distance)),
cumperc = seq(0, 100, by = 10),
ylab2 = "Porcentaje acumulado",
main = "DONDE SE CONCENTRAN LAS CIUDADES CON MAYORES DESLIZAMIENTOS")
##
## Pareto chart analysis for Distance
## Frequency Cum.Freq. Percentage Cum.Percent.
## Chihuahua 8.4657900 8.4657900 26.4005074 26.4005074
## Nueva Libertad 7.9399600 16.4057500 24.7607102 51.1612177
## Emiliano Zapata 4.6844300 21.0901800 14.6083625 65.7695802
## Ostuacán 3.7414900 24.8316700 11.6678106 77.4373908
## Motozintla de Mendoza 2.0674300 26.8991000 6.4472661 83.8846569
## Tila 1.7346900 28.6337900 5.4096187 89.2942757
## Escuintla 1.4180500 30.0518400 4.4221791 93.7164548
## San Cristóbal de las Casas 0.9411800 30.9930200 2.9350633 96.6515181
## Santo Domingo 0.7625700 31.7555900 2.3780693 99.0295873
## Amatán 0.3111800 32.0667700 0.9704127 100.0000000
stem(df_chi$"Distance")
##
## The decimal point is at the |
##
## 0 | 38947
## 2 | 17
## 4 | 7
## 6 | 9
## 8 | 5
head(df_chi)
## id date time continent_code Country country_code State population
## 1 7517 9/12/15 <NA> Mexico MX Chiapas 6089
## 2 7514 5/23/15 <NA> Mexico MX Chiapas 3796
## 3 2115 7/22/10 <NA> Mexico MX Chiapas 128996
## 4 346 11/4/07 <NA> Mexico MX Chiapas 3183
## 5 3832 7/22/11 <NA> Mexico MX Chiapas 1005
## 6 7515 10/21/15 <NA> Mexico MX Chiapas 19092
## City Distance location_description latitude longitude
## 1 Tila 1.73469 Below road 17.3112 -92.4393
## 2 Santo Domingo 0.76257 Below road 15.0337 -92.1124
## 3 San Cristóbal de las Casas 0.94118 16.7294 -92.6389
## 4 Ostuacán 3.74149 17.3900 -93.3060
## 5 Nueva Libertad 7.93996 16.1514 -92.7704
## 6 Motozintla de Mendoza 2.06743 Above road 15.3482 -92.2523
## geolocation hazard_type landslide_type
## 1 (17.311199999999999, -92.439300000000003) Landslide Landslide
## 2 (15.0337, -92.112399999999994) Landslide Landslide
## 3 (16.729399999999998, -92.638900000000007) Landslide Rockfall
## 4 (17.39, -93.305999999999997) Landslide Mudslide
## 5 (16.151399999999999, -92.770399999999995) Landslide Landslide
## 6 (15.3482, -92.252300000000005) Landslide Landslide
## landslide_size trigger storm_name injuries fatalities
## 1 Medium Rain 0 0
## 2 Medium Rain 0 0
## 3 Small Downpour NA 0
## 4 Very_large Rain NA 5
## 5 Medium Tropical cyclone Hurricane Dora NA 0
## 6 Medium Rain 0 0
## source_name
## 1 NVI noticias
## 2 Cuarto Poder
## 3
## 4 Reuters - AlertNet.org
## 5
## 6 azteca noticias
## source_link
## 1 http://www.noticiasnet.mx/portal/chiapas/general/agua/317470-lluvias-causan-deslaves-tramos-carreteros
## 2 http://www.cuartopoder.mx/deslaveafectacarreteradejandouncarril-116564.html
## 3 http://www.laht.com/article.asp?ArticleId=361041&CategoryId=14091
## 4 http://news.monstersandcritics.com/americas/news/article_1371436.php/Mudslide_is_latest_disaster_for_hard-hit_Mexico__2nd_Roundup_
## 5 http://www.china.org.cn/environment/2011-07/22/content_23044018.htm
## 6 http://www.aztecanoticias.com.mx/notas/estados/234140/suman-16-deslaves-por-lluvias-en-chiapas
## prop ypos
## 1 5.409619 2.704809
## 2 2.378069 6.598653
## 3 2.935063 9.255220
## 4 11.667811 16.556657
## 5 24.760710 34.770917
## 6 6.447266 50.374905
knitr::kable(head(df_chi))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | prop | ypos |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 7517 | 9/12/15 | NA | Mexico | MX | Chiapas | 6089 | Tila | 1.73469 | Below road | 17.3112 | -92.4393 | (17.311199999999999, -92.439300000000003) | Landslide | Landslide | Medium | Rain | 0 | 0 | NVI noticias | http://www.noticiasnet.mx/portal/chiapas/general/agua/317470-lluvias-causan-deslaves-tramos-carreteros | 5.409619 | 2.704809 | ||
| 7514 | 5/23/15 | NA | Mexico | MX | Chiapas | 3796 | Santo Domingo | 0.76257 | Below road | 15.0337 | -92.1124 | (15.0337, -92.112399999999994) | Landslide | Landslide | Medium | Rain | 0 | 0 | Cuarto Poder | http://www.cuartopoder.mx/deslaveafectacarreteradejandouncarril-116564.html | 2.378069 | 6.598653 | ||
| 2115 | 7/22/10 | NA | Mexico | MX | Chiapas | 128996 | San Cristóbal de las Casas | 0.94118 | 16.7294 | -92.6389 | (16.729399999999998, -92.638900000000007) | Landslide | Rockfall | Small | Downpour | NA | 0 | http://www.laht.com/article.asp?ArticleId=361041&CategoryId=14091 | 2.935063 | 9.255220 | ||||
| 346 | 11/4/07 | NA | Mexico | MX | Chiapas | 3183 | Ostuacán | 3.74149 | 17.3900 | -93.3060 | (17.39, -93.305999999999997) | Landslide | Mudslide | Very_large | Rain | NA | 5 | Reuters - AlertNet.org | http://news.monstersandcritics.com/americas/news/article_1371436.php/Mudslide_is_latest_disaster_for_hard-hit_Mexico__2nd_Roundup_ | 11.667811 | 16.556657 | |||
| 3832 | 7/22/11 | NA | Mexico | MX | Chiapas | 1005 | Nueva Libertad | 7.93996 | 16.1514 | -92.7704 | (16.151399999999999, -92.770399999999995) | Landslide | Landslide | Medium | Tropical cyclone | Hurricane Dora | NA | 0 | http://www.china.org.cn/environment/2011-07/22/content_23044018.htm | 24.760710 | 34.770917 | |||
| 7515 | 10/21/15 | NA | Mexico | MX | Chiapas | 19092 | Motozintla de Mendoza | 2.06743 | Above road | 15.3482 | -92.2523 | (15.3482, -92.252300000000005) | Landslide | Landslide | Medium | Rain | 0 | 0 | azteca noticias | http://www.aztecanoticias.com.mx/notas/estados/234140/suman-16-deslaves-por-lluvias-en-chiapas | 6.447266 | 50.374905 |
stem(df_chi$"Distance")
##
## The decimal point is at the |
##
## 0 | 38947
## 2 | 17
## 4 | 7
## 6 | 9
## 8 | 5
stem(df_chi$"Distance", scale = 2)
##
## The decimal point is at the |
##
## 0 | 389
## 1 | 47
## 2 | 1
## 3 | 7
## 4 | 7
## 5 |
## 6 |
## 7 | 9
## 8 | 5
library(forecast)
data<- ts(df_chi$Distance, frequency=12, start=2008)
knitr::kable(head(data))
| x |
|---|
| 1.73469 |
| 0.76257 |
| 0.94118 |
| 3.74149 |
| 7.93996 |
| 2.06743 |
autoplot(data) + labs(title = "Gráfico de series temporales", x="date", y = "distancia", colour = "green") +theme_bw()
library(questionr)
table <- questionr::freq(Distance, cum = TRUE, sort = "dec", total = TRUE)
knitr::kable(table)
| n | % | val% | %cum | val%cum | |
|---|---|---|---|---|---|
| 0.31118 | 1 | 10 | 10 | 10 | 10 |
| 0.76257 | 1 | 10 | 10 | 20 | 20 |
| 0.94118 | 1 | 10 | 10 | 30 | 30 |
| 1.41805 | 1 | 10 | 10 | 40 | 40 |
| 1.73469 | 1 | 10 | 10 | 50 | 50 |
| 2.06743 | 1 | 10 | 10 | 60 | 60 |
| 3.74149 | 1 | 10 | 10 | 70 | 70 |
| 4.68443 | 1 | 10 | 10 | 80 | 80 |
| 7.93996 | 1 | 10 | 10 | 90 | 90 |
| 8.46579 | 1 | 10 | 10 | 100 | 100 |
| Total | 10 | 100 | 100 | 100 | 100 |
str(table)
## Classes 'freqtab' and 'data.frame': 11 obs. of 5 variables:
## $ n : num 1 1 1 1 1 1 1 1 1 1 ...
## $ % : num 10 10 10 10 10 10 10 10 10 10 ...
## $ val% : num 10 10 10 10 10 10 10 10 10 10 ...
## $ %cum : num 10 20 30 40 50 60 70 80 90 100 ...
## $ val%cum: num 10 20 30 40 50 60 70 80 90 100 ...
x <- row.names(table)
y <- table$n
names <- x[1:(length(x)-1)]
freqs <- y[1:(length(y)-1)]
df_chi <- data.frame(x = names, y = freqs)
knitr::kable(df_chi)
| x | y |
|---|---|
| 0.31118 | 1 |
| 0.76257 | 1 |
| 0.94118 | 1 |
| 1.41805 | 1 |
| 1.73469 | 1 |
| 2.06743 | 1 |
| 3.74149 | 1 |
| 4.68443 | 1 |
| 7.93996 | 1 |
| 8.46579 | 1 |
library(ggplot2)
ggplot(data=df_chi, aes(x=x, y=y)) +
geom_bar(stat="identity", color="white", fill="blue") +
xlab("Rango de deslizamiento") +
ylab("Frecuencia")
n_sturges = 1 + log(length(Distance))/log(2)
n_sturgesc = ceiling(n_sturges)
n_sturgesf = floor(n_sturges)
n_clases = 0
if (n_sturgesc%%2 == 0) {
n_clases = n_sturgesf
} else {
n_clases = n_sturgesc
}
R = max(Distance) - min(Distance)
w = ceiling(R/n_clases)
bins <- seq(min(Distance), max(Distance) + w, by = w)
bins
## [1] 0.31118 2.31118 4.31118 6.31118 8.31118 10.31118
Edades <- cut(Distance, bins)
Freq_table <- transform(table(Distance), Rel_Freq=prop.table(Freq), Cum_Freq=cumsum(Freq))
knitr::kable(Freq_table)
| Distance | Freq | Rel_Freq | Cum_Freq |
|---|---|---|---|
| 0.31118 | 1 | 0.1 | 1 |
| 0.76257 | 1 | 0.1 | 2 |
| 0.94118 | 1 | 0.1 | 3 |
| 1.41805 | 1 | 0.1 | 4 |
| 1.73469 | 1 | 0.1 | 5 |
| 2.06743 | 1 | 0.1 | 6 |
| 3.74149 | 1 | 0.1 | 7 |
| 4.68443 | 1 | 0.1 | 8 |
| 7.93996 | 1 | 0.1 | 9 |
| 8.46579 | 1 | 0.1 | 10 |
str(Freq_table)
## 'data.frame': 10 obs. of 4 variables:
## $ Distance: Factor w/ 10 levels "0.31118","0.76257",..: 1 2 3 4 5 6 7 8 9 10
## $ Freq : int 1 1 1 1 1 1 1 1 1 1
## $ Rel_Freq: num 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
## $ Cum_Freq: int 1 2 3 4 5 6 7 8 9 10
df_chi <- data.frame(x = Freq_table$Distance, y = Freq_table$Freq)
knitr::kable(df_chi)
| x | y |
|---|---|
| 0.31118 | 1 |
| 0.76257 | 1 |
| 0.94118 | 1 |
| 1.41805 | 1 |
| 1.73469 | 1 |
| 2.06743 | 1 |
| 3.74149 | 1 |
| 4.68443 | 1 |
| 7.93996 | 1 |
| 8.46579 | 1 |
library(ggplot2)
ggplot(data=df_chi, aes(x=x, y=y)) +
geom_bar(stat="identity", color="blue", fill="green") +
xlab("Rango de Distance") +
ylab("Frecuencia")
Estos se encargan de la toma de datos cuantitativa con respecto a la información proporcionada, los datos se calculan a partir de la media, mediana, moda, cuartiles etc.
summary(df_chi$Distance)
## Length Class Mode
## 0 NULL NULL
library(pastecs)
stat.desc(df_chi)
## x y
## nbr.val NA 10
## nbr.null NA 0
## nbr.na NA 0
## min NA 1
## max NA 1
## range NA 0
## sum NA 10
## median NA 1
## mean NA 1
## SE.mean NA 0
## CI.mean NA 0
## var NA 0
## std.dev NA 0
## coef.var NA 0
boxplot(Distance, horizontal=TRUE, col='steelblue')
library(readr)
library(knitr)
df_mx <- subset (df, Country == "Mexico")
knitr::kable(head(df_mx))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 13 | 115 | 7/4/07 | NA | Mexico | MX | Veracruz-Llave | 1947 | Laguna Chica (Pueblo Nuevo) | 9.51003 | 18.5369 | -96.8229 | (18.536899999999999, -96.822900000000004) | Landslide | Landslide | Medium | Rain | NA | 7 | nytimes.com | http://www.nytimes.com/2007/07/04/world/americas/04cnd-mexico.html?_r=1&hp&oref=slogin | |||
| 29 | 201 | 8/23/07 | NA | Mexico | MX | Puebla | 1414 | Xochitlaxco (San Baltazar) | 1.68294 | 19.9333 | -97.8500 | (19.933299999999999, -97.85) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Dean | NA | 6 | Inquirer.com | http://newsinfo.inquirer.net/breakingnews/world/view_article.php?article_id=84452 | ||
| 31 | 225 | 9/2/07 | NA | Mexico | MX | Sinaloa | 3191 | El Limón de los Ramos | 10.88351 | 24.9531 | -107.6220 | (24.953099999999999, -107.622) | Landslide | Complex | Medium | Tropical cyclone | Tropical Storm Henrietta | NA | 3 | ||||
| 42 | 284 | 9/28/07 | NA | Mexico | MX | Puebla | 3761 | Xaltepuxtla | 7.93258 | 20.2000 | -97.9000 | (20.2, -97.9) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Lorenzo | NA | 1 | PressTV.ir | http://www.presstv.ir/detail.aspx?id=25037§ionid=3510207 | ||
| 57 | 342 | 10/31/07 | NA | Mexico | MX | Tabasco | 4468 | Buenavista | 4.19108 | 17.9493 | -92.5534 | (17.949300000000001, -92.553399999999996) | Landslide | Landslide | Medium | Rain | NA | 18 | CapeTimes | http://www.capetimes.co.za/?fArticleId=4109453 | |||
| 59 | 346 | 11/4/07 | NA | Mexico | MX | Chiapas | 3183 | Ostuacán | 3.74149 | 17.3900 | -93.3060 | (17.39, -93.305999999999997) | Landslide | Mudslide | Very_large | Rain | NA | 5 | Reuters - AlertNet.org | http://news.monstersandcritics.com/americas/news/article_1371436.php/Mudslide_is_latest_disaster_for_hard-hit_Mexico__2nd_Roundup_ |
library(readr)
library(knitr)
df_bc <- subset (df, State == "Baja California")
df_bc %>%
select(Country, State, City, Distance)
## Country State City Distance
## 73 Mexico Baja California Tijuana 12.53758
## 341 Mexico Baja California Tijuana 2.49770
## 1196 Mexico Baja California El Sauzal 12.36500
## 1493 Mexico Baja California La Esperanza [Granjas Familiares] 6.46156
library(ggplot2)
ggplot(data=df_bc, aes(x= State , y= Distance)) + geom_bar(stat="identity", color="black", fill="red")
library(ggplot2)
library(dplyr)
ggplot(data=df_bc, aes(fill=City, x="Baja California", y=Distance)) +
geom_bar(position="dodge", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_bc, aes(fill=City, x="Baja California", y=Distance)) +
geom_bar(position="stack", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_bc, aes(x = "Baja California", y = Distance , fill=City)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y", start = 0)
library(ggplot2)
library(dplyr)
df_bc <- df_bc %>%
arrange(desc(City)) %>%
mutate(prop = Distance / sum(df_bc$Distance) *100) %>%
mutate(ypos = cumsum(prop)- 0.5*prop )
require(scales)
ggplot(df_bc, aes(x= State, y = prop, fill=City)) +
geom_bar(stat="identity", width=1, color="black") +
coord_polar("y", start=0) +
theme_void() +
theme(legend.position="none") +
geom_text(aes(y = ypos, label = percent(prop/100)), color = "black", size=3) +
scale_fill_brewer(palette="Set4")
## Warning in pal_name(palette, type): Unknown palette Set4
library(qcc)
Distance <- df_bc$Distance
names(Distance) <- df_bc$City
pareto.chart(Distance,
ylab="Distance",
col = heat.colors(length(Distance)),
cumperc = seq(0, 100, by = 10),
ylab2 = "Porcentaje acumulado",
main = "DONDE SE CONCENTRAN LAS CIUDADES CON MAYORES DESLIZAMIENTOS")
##
## Pareto chart analysis for Distance
## Frequency Cum.Freq. Percentage Cum.Percent.
## Tijuana 12.53758 12.53758 37.02569 37.02569
## El Sauzal 12.36500 24.90258 36.51603 73.54172
## La Esperanza [Granjas Familiares] 6.46156 31.36414 19.08213 92.62385
## Tijuana 2.49770 33.86184 7.37615 100.00000
stem(df_bc$"Distance")
##
## The decimal point is 1 digit(s) to the right of the |
##
## 0 | 2
## 0 | 6
## 1 | 23
head(df_bc)
## id date time continent_code Country country_code State
## 1 417 1/7/08 <NA> Mexico MX Baja California
## 2 1838 5/5/10 <NA> Mexico MX Baja California
## 3 7056 5/17/15 <NA> Mexico MX Baja California
## 4 5731 12/28/13 2:00:00 <NA> Mexico MX Baja California
## population City Distance location_description
## 1 1376457 Tijuana 12.53758
## 2 1376457 Tijuana 2.49770
## 3 1173 La Esperanza [Granjas Familiares] 6.46156 Urban area
## 4 9085 El Sauzal 12.36500 Below road
## latitude longitude geolocation hazard_type
## 1 32.5755 -116.9016 (32.575499999999998, -116.9016) Landslide
## 2 32.5250 -116.9999 (32.524999999999999, -116.9999) Landslide
## 3 32.5196 -117.0898 (32.519599999999997, -117.0898) Landslide
## 4 31.9780 -116.7776 (31.978000000000002, -116.77760000000001) Landslide
## landslide_type landslide_size trigger storm_name injuries fatalities
## 1 Landslide Medium Rain NA 1
## 2 Mudslide Medium Rain NA 0
## 3 Landslide Medium Rain 0 0
## 4 Mudslide Medium Downpour NA 0
## source_name
## 1
## 2
## 3
## 4 www.globalpost.com
## source_link
## 1 http://www.signonsandiego.com/news/mexico/tijuana/20080108-1858-bn08tj.html
## 2 http://hisz.rsoe.hu/alertmap/woalert_read.php?lang=eng&cid=25962&utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+RsoeEdis-EmergencyAndDisasterInformation+%28RSOE+EDIS+-+Emergency+and+Disaster+Information%29
## 3
## 4 http://www.globalpost.com/dispatch/news/agencia-efe/131230/mudslide-closes-major-road-northwestern-mexico
## prop ypos
## 1 37.02569 18.51285
## 2 7.37615 40.71377
## 3 19.08213 53.94290
## 4 36.51603 81.74198
knitr::kable(head(df_bc))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | prop | ypos |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 417 | 1/7/08 | NA | Mexico | MX | Baja California | 1376457 | Tijuana | 12.53758 | 32.5755 | -116.9016 | (32.575499999999998, -116.9016) | Landslide | Landslide | Medium | Rain | NA | 1 | http://www.signonsandiego.com/news/mexico/tijuana/20080108-1858-bn08tj.html | 37.02569 | 18.51285 | ||||
| 1838 | 5/5/10 | NA | Mexico | MX | Baja California | 1376457 | Tijuana | 2.49770 | 32.5250 | -116.9999 | (32.524999999999999, -116.9999) | Landslide | Mudslide | Medium | Rain | NA | 0 | http://hisz.rsoe.hu/alertmap/woalert_read.php?lang=eng&cid=25962&utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+RsoeEdis-EmergencyAndDisasterInformation+%28RSOE+EDIS+-+Emergency+and+Disaster+Information%29 | 7.37615 | 40.71377 | ||||
| 7056 | 5/17/15 | NA | Mexico | MX | Baja California | 1173 | La Esperanza [Granjas Familiares] | 6.46156 | Urban area | 32.5196 | -117.0898 | (32.519599999999997, -117.0898) | Landslide | Landslide | Medium | Rain | 0 | 0 | 19.08213 | 53.94290 | ||||
| 5731 | 12/28/13 | 2:00:00 | NA | Mexico | MX | Baja California | 9085 | El Sauzal | 12.36500 | Below road | 31.9780 | -116.7776 | (31.978000000000002, -116.77760000000001) | Landslide | Mudslide | Medium | Downpour | NA | 0 | www.globalpost.com | http://www.globalpost.com/dispatch/news/agencia-efe/131230/mudslide-closes-major-road-northwestern-mexico | 36.51603 | 81.74198 |
stem(df_bc$"Distance")
##
## The decimal point is 1 digit(s) to the right of the |
##
## 0 | 2
## 0 | 6
## 1 | 23
stem(df_bc$"Distance", scale = 2)
##
## The decimal point is at the |
##
## 2 | 5
## 4 |
## 6 | 5
## 8 |
## 10 |
## 12 | 45
library(forecast)
data<- ts(df_bc$Distance, frequency=12, start=2008)
knitr::kable(head(data))
| x |
|---|
| 12.53758 |
| 2.49770 |
| 6.46156 |
| 12.36500 |
autoplot(data) + labs(title = "Gráfico de series temporales", x="date", y = "distancia", colour = "green") +theme_bw()
library(questionr)
table <- questionr::freq(Distance, cum = TRUE, sort = "dec", total = TRUE)
knitr::kable(table)
| n | % | val% | %cum | val%cum | |
|---|---|---|---|---|---|
| 2.4977 | 1 | 25 | 25 | 25 | 25 |
| 6.46156 | 1 | 25 | 25 | 50 | 50 |
| 12.365 | 1 | 25 | 25 | 75 | 75 |
| 12.53758 | 1 | 25 | 25 | 100 | 100 |
| Total | 4 | 100 | 100 | 100 | 100 |
str(table)
## Classes 'freqtab' and 'data.frame': 5 obs. of 5 variables:
## $ n : num 1 1 1 1 4
## $ % : num 25 25 25 25 100
## $ val% : num 25 25 25 25 100
## $ %cum : num 25 50 75 100 100
## $ val%cum: num 25 50 75 100 100
x <- row.names(table)
y <- table$n
names <- x[1:(length(x)-1)]
freqs <- y[1:(length(y)-1)]
df_bc <- data.frame(x = names, y = freqs)
knitr::kable(df_bc)
| x | y |
|---|---|
| 2.4977 | 1 |
| 6.46156 | 1 |
| 12.365 | 1 |
| 12.53758 | 1 |
library(ggplot2)
ggplot(data=df_bc, aes(x=x, y=y)) +
geom_bar(stat="identity", color="white", fill="blue") +
xlab("Rango de deslizamiento") +
ylab("Frecuencia")
n_sturges = 1 + log(length(Distance))/log(2)
n_sturgesc = ceiling(n_sturges)
n_sturgesf = floor(n_sturges)
n_clases = 0
if (n_sturgesc%%2 == 0) {
n_clases = n_sturgesf
} else {
n_clases = n_sturgesc
}
R = max(Distance) - min(Distance)
w = ceiling(R/n_clases)
bins <- seq(min(Distance), max(Distance) + w, by = w)
bins
## [1] 2.4977 6.4977 10.4977 14.4977
Edades <- cut(Distance, bins)
Freq_table <- transform(table(Distance), Rel_Freq=prop.table(Freq), Cum_Freq=cumsum(Freq))
knitr::kable(Freq_table)
| Distance | Freq | Rel_Freq | Cum_Freq |
|---|---|---|---|
| 2.4977 | 1 | 0.25 | 1 |
| 6.46156 | 1 | 0.25 | 2 |
| 12.365 | 1 | 0.25 | 3 |
| 12.53758 | 1 | 0.25 | 4 |
str(Freq_table)
## 'data.frame': 4 obs. of 4 variables:
## $ Distance: Factor w/ 4 levels "2.4977","6.46156",..: 1 2 3 4
## $ Freq : int 1 1 1 1
## $ Rel_Freq: num 0.25 0.25 0.25 0.25
## $ Cum_Freq: int 1 2 3 4
df_bc <- data.frame(x = Freq_table$Distance, y = Freq_table$Freq)
knitr::kable(df_bc)
| x | y |
|---|---|
| 2.4977 | 1 |
| 6.46156 | 1 |
| 12.365 | 1 |
| 12.53758 | 1 |
library(ggplot2)
ggplot(data=df_bc, aes(x=x, y=y)) +
geom_bar(stat="identity", color="blue", fill="green") +
xlab("Rango de Distance") +
ylab("Frecuencia")
Estos se encargan de la toma de datos cuantitativa con respecto a la información proporcionada, los datos se calculan a partir de la media, mediana, moda, cuartiles etc.
summary(df_bc$Distance)
## Length Class Mode
## 0 NULL NULL
library(pastecs)
stat.desc(df_bc)
## x y
## nbr.val NA 4
## nbr.null NA 0
## nbr.na NA 0
## min NA 1
## max NA 1
## range NA 0
## sum NA 4
## median NA 1
## mean NA 1
## SE.mean NA 0
## CI.mean NA 0
## var NA 0
## std.dev NA 0
## coef.var NA 0
boxplot(Distance, horizontal=TRUE, col='steelblue')
library(readr)
library(knitr)
df_mx <- subset (df, Country == "Mexico")
knitr::kable(head(df_mx))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 13 | 115 | 7/4/07 | NA | Mexico | MX | Veracruz-Llave | 1947 | Laguna Chica (Pueblo Nuevo) | 9.51003 | 18.5369 | -96.8229 | (18.536899999999999, -96.822900000000004) | Landslide | Landslide | Medium | Rain | NA | 7 | nytimes.com | http://www.nytimes.com/2007/07/04/world/americas/04cnd-mexico.html?_r=1&hp&oref=slogin | |||
| 29 | 201 | 8/23/07 | NA | Mexico | MX | Puebla | 1414 | Xochitlaxco (San Baltazar) | 1.68294 | 19.9333 | -97.8500 | (19.933299999999999, -97.85) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Dean | NA | 6 | Inquirer.com | http://newsinfo.inquirer.net/breakingnews/world/view_article.php?article_id=84452 | ||
| 31 | 225 | 9/2/07 | NA | Mexico | MX | Sinaloa | 3191 | El Limón de los Ramos | 10.88351 | 24.9531 | -107.6220 | (24.953099999999999, -107.622) | Landslide | Complex | Medium | Tropical cyclone | Tropical Storm Henrietta | NA | 3 | ||||
| 42 | 284 | 9/28/07 | NA | Mexico | MX | Puebla | 3761 | Xaltepuxtla | 7.93258 | 20.2000 | -97.9000 | (20.2, -97.9) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Lorenzo | NA | 1 | PressTV.ir | http://www.presstv.ir/detail.aspx?id=25037§ionid=3510207 | ||
| 57 | 342 | 10/31/07 | NA | Mexico | MX | Tabasco | 4468 | Buenavista | 4.19108 | 17.9493 | -92.5534 | (17.949300000000001, -92.553399999999996) | Landslide | Landslide | Medium | Rain | NA | 18 | CapeTimes | http://www.capetimes.co.za/?fArticleId=4109453 | |||
| 59 | 346 | 11/4/07 | NA | Mexico | MX | Chiapas | 3183 | Ostuacán | 3.74149 | 17.3900 | -93.3060 | (17.39, -93.305999999999997) | Landslide | Mudslide | Very_large | Rain | NA | 5 | Reuters - AlertNet.org | http://news.monstersandcritics.com/americas/news/article_1371436.php/Mudslide_is_latest_disaster_for_hard-hit_Mexico__2nd_Roundup_ |
library(readr)
library(knitr)
df_me <- subset (df, State == "México")
df_me %>%
select(Country, State, City, Distance)
## Country State City Distance
## 137 Mexico México San Francisco Chimalpa 2.59637
## 255 Mexico México Toluca 0.66626
## 260 Mexico México Zacazonapan 4.40801
## 449 Mexico México Villa Guerrero 1.06048
library(ggplot2)
ggplot(data=df_me, aes(x= State , y= Distance)) + geom_bar(stat="identity", color="black", fill="red")
library(ggplot2)
library(dplyr)
ggplot(data=df_me, aes(fill=City, x="México", y=Distance)) +
geom_bar(position="dodge", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_me, aes(fill=City, x="México", y=Distance)) +
geom_bar(position="stack", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_me, aes(x = "México", y = Distance , fill=City)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y", start = 0)
library(ggplot2)
library(dplyr)
df_me <- df_me %>%
arrange(desc(City)) %>%
mutate(prop = Distance / sum(df_me$Distance) *100) %>%
mutate(ypos = cumsum(prop)- 0.5*prop )
require(scales)
ggplot(df_me, aes(x= State, y = prop, fill=City)) +
geom_bar(stat="identity", width=1, color="black") +
coord_polar("y", start=0) +
theme_void() +
theme(legend.position="none") +
geom_text(aes(y = ypos, label = percent(prop/100)), color = "black", size=3) +
scale_fill_brewer(palette="Set4")
## Warning in pal_name(palette, type): Unknown palette Set4
library(qcc)
Distance <- df_me$Distance
names(Distance) <- df_me$City
pareto.chart(Distance,
ylab="Distance",
col = heat.colors(length(Distance)),
cumperc = seq(0, 100, by = 10),
ylab2 = "Porcentaje acumulado",
main = "DONDE SE CONCENTRAN LAS CIUDADES CON MAYORES DESLIZAMIENTOS")
##
## Pareto chart analysis for Distance
## Frequency Cum.Freq. Percentage Cum.Percent.
## Zacazonapan 4.408010 4.408010 50.486192 50.486192
## San Francisco Chimalpa 2.596370 7.004380 29.736964 80.223156
## Villa Guerrero 1.060480 8.064860 12.145979 92.369135
## Toluca 0.666260 8.731120 7.630865 100.000000
stem(df_me$"Distance")
##
## The decimal point is at the |
##
## 0 | 7
## 1 | 1
## 2 | 6
## 3 |
## 4 | 4
head(df_me)
## id date time continent_code Country country_code State population
## 1 1477 2/4/10 22:00 <NA> Mexico MX México 2968
## 2 2474 9/20/10 Late night <NA> Mexico MX México 9267
## 3 1469 2/5/10 <NA> Mexico MX México 505881
## 4 744 8/25/08 <NA> Mexico MX México 7182
## City Distance location_description latitude longitude
## 1 Zacazonapan 4.40801 Above road 19.1927 -99.8654
## 2 Villa Guerrero 1.06048 18.9642 -99.6511
## 3 Toluca 0.66626 19.2880 -99.6469
## 4 San Francisco Chimalpa 2.59637 19.4360 -99.3650
## geolocation hazard_type landslide_type
## 1 (19.192699999999999, -99.865399999999994) Landslide Mudslide
## 2 (18.964200000000002, -99.6511) Landslide Landslide
## 3 (19.288, -99.646900000000002) Landslide Landslide
## 4 (19.436, -99.364999999999995) Landslide Mudslide
## landslide_size trigger storm_name injuries fatalities source_name
## 1 Large Downpour NA 11 News Daily
## 2 Large Downpour NA 8
## 3 Large Downpour NA 11
## 4 Medium Downpour NA 1
## source_link
## 1 http://www.newsdaily.com/stories/tre6151we-us-mexico-mudslide/
## 2 http://www.alertnet.org/thenews/newsdesk/N21168920.htm
## 3 http://www.trt.net.tr/trtinternational/en/newsDetail.aspx?HaberKodu=dc2169ea-80de-437d-a57a-eb11725c40e5
## 4 http://www.alertnet.org/thenews/newsdesk/N26335664.htm
## prop ypos
## 1 50.486192 25.24310
## 2 12.145979 56.55918
## 3 7.630865 66.44760
## 4 29.736964 85.13152
knitr::kable(head(df_me))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | prop | ypos |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1477 | 2/4/10 | 22:00 | NA | Mexico | MX | México | 2968 | Zacazonapan | 4.40801 | Above road | 19.1927 | -99.8654 | (19.192699999999999, -99.865399999999994) | Landslide | Mudslide | Large | Downpour | NA | 11 | News Daily | http://www.newsdaily.com/stories/tre6151we-us-mexico-mudslide/ | 50.486192 | 25.24310 | |
| 2474 | 9/20/10 | Late night | NA | Mexico | MX | México | 9267 | Villa Guerrero | 1.06048 | 18.9642 | -99.6511 | (18.964200000000002, -99.6511) | Landslide | Landslide | Large | Downpour | NA | 8 | http://www.alertnet.org/thenews/newsdesk/N21168920.htm | 12.145979 | 56.55918 | |||
| 1469 | 2/5/10 | NA | Mexico | MX | México | 505881 | Toluca | 0.66626 | 19.2880 | -99.6469 | (19.288, -99.646900000000002) | Landslide | Landslide | Large | Downpour | NA | 11 | http://www.trt.net.tr/trtinternational/en/newsDetail.aspx?HaberKodu=dc2169ea-80de-437d-a57a-eb11725c40e5 | 7.630865 | 66.44760 | ||||
| 744 | 8/25/08 | NA | Mexico | MX | México | 7182 | San Francisco Chimalpa | 2.59637 | 19.4360 | -99.3650 | (19.436, -99.364999999999995) | Landslide | Mudslide | Medium | Downpour | NA | 1 | http://www.alertnet.org/thenews/newsdesk/N26335664.htm | 29.736964 | 85.13152 |
stem(df_me$"Distance")
##
## The decimal point is at the |
##
## 0 | 7
## 1 | 1
## 2 | 6
## 3 |
## 4 | 4
stem(df_me$"Distance", scale = 2)
##
## The decimal point is at the |
##
## 0 | 7
## 1 | 1
## 1 |
## 2 |
## 2 | 6
## 3 |
## 3 |
## 4 | 4
library(forecast)
data<- ts(df_me$Distance, frequency=12, start=2008)
knitr::kable(head(data))
| x |
|---|
| 4.40801 |
| 1.06048 |
| 0.66626 |
| 2.59637 |
autoplot(data) + labs(title = "Gráfico de series temporales", x="date", y = "distancia", colour = "green") +theme_bw()
library(questionr)
table <- questionr::freq(Distance, cum = TRUE, sort = "dec", total = TRUE)
knitr::kable(table)
| n | % | val% | %cum | val%cum | |
|---|---|---|---|---|---|
| 0.66626 | 1 | 25 | 25 | 25 | 25 |
| 1.06048 | 1 | 25 | 25 | 50 | 50 |
| 2.59637 | 1 | 25 | 25 | 75 | 75 |
| 4.40801 | 1 | 25 | 25 | 100 | 100 |
| Total | 4 | 100 | 100 | 100 | 100 |
str(table)
## Classes 'freqtab' and 'data.frame': 5 obs. of 5 variables:
## $ n : num 1 1 1 1 4
## $ % : num 25 25 25 25 100
## $ val% : num 25 25 25 25 100
## $ %cum : num 25 50 75 100 100
## $ val%cum: num 25 50 75 100 100
x <- row.names(table)
y <- table$n
names <- x[1:(length(x)-1)]
freqs <- y[1:(length(y)-1)]
df_me <- data.frame(x = names, y = freqs)
knitr::kable(df_me)
| x | y |
|---|---|
| 0.66626 | 1 |
| 1.06048 | 1 |
| 2.59637 | 1 |
| 4.40801 | 1 |
library(ggplot2)
ggplot(data=df_me, aes(x=x, y=y)) +
geom_bar(stat="identity", color="white", fill="blue") +
xlab("Rango de deslizamiento") +
ylab("Frecuencia")
n_sturges = 1 + log(length(Distance))/log(2)
n_sturgesc = ceiling(n_sturges)
n_sturgesf = floor(n_sturges)
n_clases = 0
if (n_sturgesc%%2 == 0) {
n_clases = n_sturgesf
} else {
n_clases = n_sturgesc
}
R = max(Distance) - min(Distance)
w = ceiling(R/n_clases)
bins <- seq(min(Distance), max(Distance) + w, by = w)
bins
## [1] 0.66626 2.66626 4.66626
Edades <- cut(Distance, bins)
Freq_table <- transform(table(Distance), Rel_Freq=prop.table(Freq), Cum_Freq=cumsum(Freq))
knitr::kable(Freq_table)
| Distance | Freq | Rel_Freq | Cum_Freq |
|---|---|---|---|
| 0.66626 | 1 | 0.25 | 1 |
| 1.06048 | 1 | 0.25 | 2 |
| 2.59637 | 1 | 0.25 | 3 |
| 4.40801 | 1 | 0.25 | 4 |
str(Freq_table)
## 'data.frame': 4 obs. of 4 variables:
## $ Distance: Factor w/ 4 levels "0.66626","1.06048",..: 1 2 3 4
## $ Freq : int 1 1 1 1
## $ Rel_Freq: num 0.25 0.25 0.25 0.25
## $ Cum_Freq: int 1 2 3 4
df_me <- data.frame(x = Freq_table$Distance, y = Freq_table$Freq)
knitr::kable(df_me)
| x | y |
|---|---|
| 0.66626 | 1 |
| 1.06048 | 1 |
| 2.59637 | 1 |
| 4.40801 | 1 |
library(ggplot2)
ggplot(data=df_me, aes(x=x, y=y)) +
geom_bar(stat="identity", color="blue", fill="green") +
xlab("Rango de Distance") +
ylab("Frecuencia")
Estos se encargan de la toma de datos cuantitativa con respecto a la información proporcionada, los datos se calculan a partir de la media, mediana, moda, cuartiles etc.
summary(df_me$Distance)
## Length Class Mode
## 0 NULL NULL
library(pastecs)
stat.desc(df_me)
## x y
## nbr.val NA 4
## nbr.null NA 0
## nbr.na NA 0
## min NA 1
## max NA 1
## range NA 0
## sum NA 4
## median NA 1
## mean NA 1
## SE.mean NA 0
## CI.mean NA 0
## var NA 0
## std.dev NA 0
## coef.var NA 0
boxplot(Distance, horizontal=TRUE, col='steelblue')
library(readr)
library(knitr)
df_mx <- subset (df, Country == "Mexico")
knitr::kable(head(df_mx))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 13 | 115 | 7/4/07 | NA | Mexico | MX | Veracruz-Llave | 1947 | Laguna Chica (Pueblo Nuevo) | 9.51003 | 18.5369 | -96.8229 | (18.536899999999999, -96.822900000000004) | Landslide | Landslide | Medium | Rain | NA | 7 | nytimes.com | http://www.nytimes.com/2007/07/04/world/americas/04cnd-mexico.html?_r=1&hp&oref=slogin | |||
| 29 | 201 | 8/23/07 | NA | Mexico | MX | Puebla | 1414 | Xochitlaxco (San Baltazar) | 1.68294 | 19.9333 | -97.8500 | (19.933299999999999, -97.85) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Dean | NA | 6 | Inquirer.com | http://newsinfo.inquirer.net/breakingnews/world/view_article.php?article_id=84452 | ||
| 31 | 225 | 9/2/07 | NA | Mexico | MX | Sinaloa | 3191 | El Limón de los Ramos | 10.88351 | 24.9531 | -107.6220 | (24.953099999999999, -107.622) | Landslide | Complex | Medium | Tropical cyclone | Tropical Storm Henrietta | NA | 3 | ||||
| 42 | 284 | 9/28/07 | NA | Mexico | MX | Puebla | 3761 | Xaltepuxtla | 7.93258 | 20.2000 | -97.9000 | (20.2, -97.9) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Lorenzo | NA | 1 | PressTV.ir | http://www.presstv.ir/detail.aspx?id=25037§ionid=3510207 | ||
| 57 | 342 | 10/31/07 | NA | Mexico | MX | Tabasco | 4468 | Buenavista | 4.19108 | 17.9493 | -92.5534 | (17.949300000000001, -92.553399999999996) | Landslide | Landslide | Medium | Rain | NA | 18 | CapeTimes | http://www.capetimes.co.za/?fArticleId=4109453 | |||
| 59 | 346 | 11/4/07 | NA | Mexico | MX | Chiapas | 3183 | Ostuacán | 3.74149 | 17.3900 | -93.3060 | (17.39, -93.305999999999997) | Landslide | Mudslide | Very_large | Rain | NA | 5 | Reuters - AlertNet.org | http://news.monstersandcritics.com/americas/news/article_1371436.php/Mudslide_is_latest_disaster_for_hard-hit_Mexico__2nd_Roundup_ |
library(readr)
library(knitr)
df_tfd <- subset (df, State == "The Federal District")
df_tfd %>%
select(Country, State, City, Distance)
## Country State City Distance
## 177 Mexico The Federal District Mexico City 0.15208
## 210 Mexico The Federal District Magdalena Contreras 3.49173
## 401 Mexico The Federal District Mexico City 0.15208
library(ggplot2)
ggplot(data=df_tfd, aes(x= State , y= Distance)) + geom_bar(stat="identity", color="black", fill="red")
library(ggplot2)
library(dplyr)
ggplot(data=df_tfd, aes(fill=City, x="The Federal District", y=Distance)) +
geom_bar(position="dodge", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_tfd, aes(fill=City, x="The Federal District", y=Distance)) +
geom_bar(position="stack", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_tfd, aes(x = "The Federal District", y = Distance , fill=City)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y", start = 0)
library(ggplot2)
library(dplyr)
df_tfd <- df_tfd %>%
arrange(desc(City)) %>%
mutate(prop = Distance / sum(df_tfd$Distance) *100) %>%
mutate(ypos = cumsum(prop)- 0.5*prop )
require(scales)
ggplot(df_tfd, aes(x= State, y = prop, fill=City)) +
geom_bar(stat="identity", width=1, color="black") +
coord_polar("y", start=0) +
theme_void() +
theme(legend.position="none") +
geom_text(aes(y = ypos, label = percent(prop/100)), color = "black", size=3) +
scale_fill_brewer(palette="Set4")
## Warning in pal_name(palette, type): Unknown palette Set4
library(qcc)
Distance <- df_tfd$Distance
names(Distance) <- df_tfd$City
pareto.chart(Distance,
ylab="Distance",
col = heat.colors(length(Distance)),
cumperc = seq(0, 100, by = 10),
ylab2 = "Porcentaje acumulado",
main = "DONDE SE CONCENTRAN LAS CIUDADES CON MAYORES DESLIZAMIENTOS")
##
## Pareto chart analysis for Distance
## Frequency Cum.Freq. Percentage Cum.Percent.
## Magdalena Contreras 3.491730 3.491730 91.987123 91.987123
## Mexico City 0.152080 3.643810 4.006439 95.993561
## Mexico City 0.152080 3.795890 4.006439 100.000000
stem(df_tfd$"Distance")
##
## The decimal point is at the |
##
## 0 | 22
## 1 |
## 2 |
## 3 | 5
head(df_tfd)
## id date time continent_code Country country_code State
## 1 975 1/22/09 <NA> Mexico MX The Federal District
## 2 2191 8/2/10 <NA> Mexico MX The Federal District
## 3 1167 9/15/09 <NA> Mexico MX The Federal District
## population City Distance location_description latitude
## 1 12294193 Mexico City 0.15208 19.4271
## 2 12294193 Mexico City 0.15208 19.4270
## 3 228927 Magdalena Contreras 3.49173 19.3161
## longitude geolocation hazard_type
## 1 -99.1276 (19.427099999999999, -99.127600000000001) Landslide
## 2 -99.1276 (19.427, -99.127600000000001) Landslide
## 3 -99.2398 (19.316099999999999, -99.239800000000002) Landslide
## landslide_type landslide_size trigger storm_name injuries fatalities
## 1 Landslide Medium Downpour NA 2
## 2 Mudslide Medium Construction NA 2
## 3 Mudslide Medium Downpour NA 3
## source_name
## 1
## 2
## 3
## source_link
## 1
## 2
## 3 http://edition.cnn.com/2009/WORLD/americas/09/16/mexico.mudslide.deaths/
## prop ypos
## 1 4.006439 2.003219
## 2 4.006439 6.009658
## 3 91.987123 54.006439
knitr::kable(head(df_tfd))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | prop | ypos |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 975 | 1/22/09 | NA | Mexico | MX | The Federal District | 12294193 | Mexico City | 0.15208 | 19.4271 | -99.1276 | (19.427099999999999, -99.127600000000001) | Landslide | Landslide | Medium | Downpour | NA | 2 | 4.006438 | 2.003219 | |||||
| 2191 | 8/2/10 | NA | Mexico | MX | The Federal District | 12294193 | Mexico City | 0.15208 | 19.4270 | -99.1276 | (19.427, -99.127600000000001) | Landslide | Mudslide | Medium | Construction | NA | 2 | 4.006438 | 6.009658 | |||||
| 1167 | 9/15/09 | NA | Mexico | MX | The Federal District | 228927 | Magdalena Contreras | 3.49173 | 19.3161 | -99.2398 | (19.316099999999999, -99.239800000000002) | Landslide | Mudslide | Medium | Downpour | NA | 3 | http://edition.cnn.com/2009/WORLD/americas/09/16/mexico.mudslide.deaths/ | 91.987123 | 54.006439 |
stem(df_tfd$"Distance")
##
## The decimal point is at the |
##
## 0 | 22
## 1 |
## 2 |
## 3 | 5
stem(df_tfd$"Distance", scale = 2)
##
## The decimal point is at the |
##
## 0 | 22
## 0 |
## 1 |
## 1 |
## 2 |
## 2 |
## 3 |
## 3 | 5
library(forecast)
data<- ts(df_tfd$Distance, frequency=12, start=2008)
knitr::kable(head(data))
| x |
|---|
| 0.15208 |
| 0.15208 |
| 3.49173 |
autoplot(data) + labs(title = "Gráfico de series temporales", x="date", y = "distancia", colour = "green") +theme_bw()
library(questionr)
table <- questionr::freq(Distance, cum = TRUE, sort = "dec", total = TRUE)
knitr::kable(table)
| n | % | val% | %cum | val%cum | |
|---|---|---|---|---|---|
| 0.15208 | 2 | 66.7 | 66.7 | 66.7 | 66.7 |
| 3.49173 | 1 | 33.3 | 33.3 | 100.0 | 100.0 |
| Total | 3 | 100.0 | 100.0 | 100.0 | 100.0 |
str(table)
## Classes 'freqtab' and 'data.frame': 3 obs. of 5 variables:
## $ n : num 2 1 3
## $ % : num 66.7 33.3 100
## $ val% : num 66.7 33.3 100
## $ %cum : num 66.7 100 100
## $ val%cum: num 66.7 100 100
x <- row.names(table)
y <- table$n
names <- x[1:(length(x)-1)]
freqs <- y[1:(length(y)-1)]
df_tfd <- data.frame(x = names, y = freqs)
knitr::kable(df_tfd)
| x | y |
|---|---|
| 0.15208 | 2 |
| 3.49173 | 1 |
library(ggplot2)
ggplot(data=df_tfd, aes(x=x, y=y)) +
geom_bar(stat="identity", color="white", fill="blue") +
xlab("Rango de deslizamiento") +
ylab("Frecuencia")
n_sturges = 1 + log(length(Distance))/log(2)
n_sturgesc = ceiling(n_sturges)
n_sturgesf = floor(n_sturges)
n_clases = 0
if (n_sturgesc%%2 == 0) {
n_clases = n_sturgesf
} else {
n_clases = n_sturgesc
}
R = max(Distance) - min(Distance)
w = ceiling(R/n_clases)
bins <- seq(min(Distance), max(Distance) + w, by = w)
bins
## [1] 0.15208 2.15208 4.15208
Edades <- cut(Distance, bins)
Freq_table <- transform(table(Distance), Rel_Freq=prop.table(Freq), Cum_Freq=cumsum(Freq))
knitr::kable(Freq_table)
| Distance | Freq | Rel_Freq | Cum_Freq |
|---|---|---|---|
| 0.15208 | 2 | 0.6666667 | 2 |
| 3.49173 | 1 | 0.3333333 | 3 |
str(Freq_table)
## 'data.frame': 2 obs. of 4 variables:
## $ Distance: Factor w/ 2 levels "0.15208","3.49173": 1 2
## $ Freq : int 2 1
## $ Rel_Freq: num 0.667 0.333
## $ Cum_Freq: int 2 3
df_tfd <- data.frame(x = Freq_table$Distance, y = Freq_table$Freq)
knitr::kable(df_tfd)
| x | y |
|---|---|
| 0.15208 | 2 |
| 3.49173 | 1 |
library(ggplot2)
ggplot(data=df_tfd, aes(x=x, y=y)) +
geom_bar(stat="identity", color="blue", fill="green") +
xlab("Rango de Distance") +
ylab("Frecuencia")
Estos se encargan de la toma de datos cuantitativa con respecto a la información proporcionada, los datos se calculan a partir de la media, mediana, moda, cuartiles etc.
summary(df_tfd$Distance)
## Length Class Mode
## 0 NULL NULL
library(pastecs)
stat.desc(df_tfd)
## x y
## nbr.val NA 2.0000000
## nbr.null NA 0.0000000
## nbr.na NA 0.0000000
## min NA 1.0000000
## max NA 2.0000000
## range NA 1.0000000
## sum NA 3.0000000
## median NA 1.5000000
## mean NA 1.5000000
## SE.mean NA 0.5000000
## CI.mean NA 6.3531024
## var NA 0.5000000
## std.dev NA 0.7071068
## coef.var NA 0.4714045
boxplot(Distance, horizontal=TRUE, col='steelblue')
library(readr)
library(knitr)
df_mx <- subset (df, Country == "Mexico")
knitr::kable(head(df_mx))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 13 | 115 | 7/4/07 | NA | Mexico | MX | Veracruz-Llave | 1947 | Laguna Chica (Pueblo Nuevo) | 9.51003 | 18.5369 | -96.8229 | (18.536899999999999, -96.822900000000004) | Landslide | Landslide | Medium | Rain | NA | 7 | nytimes.com | http://www.nytimes.com/2007/07/04/world/americas/04cnd-mexico.html?_r=1&hp&oref=slogin | |||
| 29 | 201 | 8/23/07 | NA | Mexico | MX | Puebla | 1414 | Xochitlaxco (San Baltazar) | 1.68294 | 19.9333 | -97.8500 | (19.933299999999999, -97.85) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Dean | NA | 6 | Inquirer.com | http://newsinfo.inquirer.net/breakingnews/world/view_article.php?article_id=84452 | ||
| 31 | 225 | 9/2/07 | NA | Mexico | MX | Sinaloa | 3191 | El Limón de los Ramos | 10.88351 | 24.9531 | -107.6220 | (24.953099999999999, -107.622) | Landslide | Complex | Medium | Tropical cyclone | Tropical Storm Henrietta | NA | 3 | ||||
| 42 | 284 | 9/28/07 | NA | Mexico | MX | Puebla | 3761 | Xaltepuxtla | 7.93258 | 20.2000 | -97.9000 | (20.2, -97.9) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Lorenzo | NA | 1 | PressTV.ir | http://www.presstv.ir/detail.aspx?id=25037§ionid=3510207 | ||
| 57 | 342 | 10/31/07 | NA | Mexico | MX | Tabasco | 4468 | Buenavista | 4.19108 | 17.9493 | -92.5534 | (17.949300000000001, -92.553399999999996) | Landslide | Landslide | Medium | Rain | NA | 18 | CapeTimes | http://www.capetimes.co.za/?fArticleId=4109453 | |||
| 59 | 346 | 11/4/07 | NA | Mexico | MX | Chiapas | 3183 | Ostuacán | 3.74149 | 17.3900 | -93.3060 | (17.39, -93.305999999999997) | Landslide | Mudslide | Very_large | Rain | NA | 5 | Reuters - AlertNet.org | http://news.monstersandcritics.com/americas/news/article_1371436.php/Mudslide_is_latest_disaster_for_hard-hit_Mexico__2nd_Roundup_ |
library(readr)
library(knitr)
df_mh <- subset (df, State == "Michoacán")
df_mh %>%
select(Country, State, City, Distance)
## Country State City Distance
## 256 Mexico Michoacán Heroica Zitácuaro 4.18059
## 257 Mexico Michoacán Jarácuaro 3.42740
## 258 Mexico Michoacán Mineral de Angangueo 1.69508
## 801 Mexico Michoacán Jarácuaro 3.36905
library(ggplot2)
ggplot(data=df_mh, aes(x= State , y= Distance)) + geom_bar(stat="identity", color="black", fill="green")
library(ggplot2)
library(dplyr)
ggplot(data=df_mh, aes(fill=City, x="Michoacán", y=Distance)) +
geom_bar(position="dodge", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_mh, aes(fill=City, x="Michoacán", y=Distance)) +
geom_bar(position="stack", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_mh, aes(x = "Michoacán", y = Distance , fill=City)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y", start = 0)
library(ggplot2)
library(dplyr)
df_mh <- df_mh %>%
arrange(desc(City)) %>%
mutate(prop = Distance / sum(df_mh$Distance) *100) %>%
mutate(ypos = cumsum(prop)- 0.5*prop )
require(scales)
ggplot(df_mh, aes(x= State, y = prop, fill=City)) +
geom_bar(stat="identity", width=1, color="black") +
coord_polar("y", start=0) +
theme_void() +
theme(legend.position="none") +
geom_text(aes(y = ypos, label = percent(prop/100)), color = "black", size=3) +
scale_fill_brewer(palette="Set4")
## Warning in pal_name(palette, type): Unknown palette Set4
library(qcc)
Distance <- df_mh$Distance
names(Distance) <- df_mh$City
pareto.chart(Distance,
ylab="Distance",
col = heat.colors(length(Distance)),
cumperc = seq(0, 100, by = 10),
ylab2 = "Porcentaje acumulado",
main = "DONDE SE CONCENTRAN LAS CIUDADES CON MAYORES DESLIZAMIENTOS")
##
## Pareto chart analysis for Distance
## Frequency Cum.Freq. Percentage Cum.Percent.
## Heroica Zitácuaro 4.18059 4.18059 32.99045 32.99045
## Jarácuaro 3.42740 7.60799 27.04678 60.03723
## Jarácuaro 3.36905 10.97704 26.58632 86.62355
## Mineral de Angangueo 1.69508 12.67212 13.37645 100.00000
stem(df_mh$"Distance")
##
## The decimal point is at the |
##
## 1 | 7
## 2 |
## 2 |
## 3 | 44
## 3 |
## 4 | 2
head(df_mh)
## id date time continent_code Country country_code State population
## 1 1472 2/5/10 <NA> Mexico MX Michoacán 4943
## 2 1471 2/5/10 <NA> Mexico MX Michoacán 2817
## 3 3835 7/22/11 <NA> Mexico MX Michoacán 2817
## 4 1470 2/5/10 <NA> Mexico MX Michoacán 78950
## City Distance location_description latitude longitude
## 1 Mineral de Angangueo 1.69508 19.6167 -100.3000
## 2 Jarácuaro 3.42740 19.5670 -101.7098
## 3 Jarácuaro 3.36905 19.5805 -101.7023
## 4 Heroica Zitácuaro 4.18059 19.4000 -100.3667
## geolocation hazard_type landslide_type
## 1 (19.616700000000002, -100.3) Landslide Mudslide
## 2 (19.567, -101.7098) Landslide Mudslide
## 3 (19.580500000000001, -101.70229999999999) Landslide Landslide
## 4 (19.399999999999999, -100.36669999999999) Landslide Mudslide
## landslide_size trigger storm_name injuries fatalities
## 1 Medium Downpour NA 3
## 2 Medium Downpour NA 1
## 3 Medium Tropical cyclone Hurricane Dora NA 0
## 4 Medium Downpour NA 2
## source_name
## 1
## 2
## 3
## 4
## source_link
## 1 http://www.aajtv.com/news/World/158635_detail.html
## 2 http://www.sott.net/articles/show/202533-Mexico-rainstorms-leave-at-least-15-dead
## 3
## 4 http://www.sott.net/articles/show/202533-Mexico-rainstorms-leave-at-least-15-dead
## prop ypos
## 1 13.37645 6.688226
## 2 27.04678 26.899840
## 3 26.58632 53.716387
## 4 32.99045 83.504773
knitr::kable(head(df_mh))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | prop | ypos |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1472 | 2/5/10 | NA | Mexico | MX | Michoacán | 4943 | Mineral de Angangueo | 1.69508 | 19.6167 | -100.3000 | (19.616700000000002, -100.3) | Landslide | Mudslide | Medium | Downpour | NA | 3 | http://www.aajtv.com/news/World/158635_detail.html | 13.37645 | 6.688226 | ||||
| 1471 | 2/5/10 | NA | Mexico | MX | Michoacán | 2817 | Jarácuaro | 3.42740 | 19.5670 | -101.7098 | (19.567, -101.7098) | Landslide | Mudslide | Medium | Downpour | NA | 1 | http://www.sott.net/articles/show/202533-Mexico-rainstorms-leave-at-least-15-dead | 27.04678 | 26.899840 | ||||
| 3835 | 7/22/11 | NA | Mexico | MX | Michoacán | 2817 | Jarácuaro | 3.36905 | 19.5805 | -101.7023 | (19.580500000000001, -101.70229999999999) | Landslide | Landslide | Medium | Tropical cyclone | Hurricane Dora | NA | 0 | 26.58632 | 53.716387 | ||||
| 1470 | 2/5/10 | NA | Mexico | MX | Michoacán | 78950 | Heroica Zitácuaro | 4.18059 | 19.4000 | -100.3667 | (19.399999999999999, -100.36669999999999) | Landslide | Mudslide | Medium | Downpour | NA | 2 | http://www.sott.net/articles/show/202533-Mexico-rainstorms-leave-at-least-15-dead | 32.99045 | 83.504773 |
stem(df_mh$"Distance")
##
## The decimal point is at the |
##
## 1 | 7
## 2 |
## 2 |
## 3 | 44
## 3 |
## 4 | 2
stem(df_mh$"Distance", scale = 2)
##
## The decimal point is at the |
##
## 1 | 7
## 2 |
## 2 |
## 3 | 44
## 3 |
## 4 | 2
library(forecast)
data<- ts(df_mh$Distance, frequency=12, start=2008)
knitr::kable(head(data))
| x |
|---|
| 1.69508 |
| 3.42740 |
| 3.36905 |
| 4.18059 |
autoplot(data) + labs(title = "Gráfico de series temporales", x="date", y = "distancia", colour = "green") +theme_bw()
library(questionr)
table <- questionr::freq(Distance, cum = TRUE, sort = "dec", total = TRUE)
knitr::kable(table)
| n | % | val% | %cum | val%cum | |
|---|---|---|---|---|---|
| 1.69508 | 1 | 25 | 25 | 25 | 25 |
| 3.36905 | 1 | 25 | 25 | 50 | 50 |
| 3.4274 | 1 | 25 | 25 | 75 | 75 |
| 4.18059 | 1 | 25 | 25 | 100 | 100 |
| Total | 4 | 100 | 100 | 100 | 100 |
str(table)
## Classes 'freqtab' and 'data.frame': 5 obs. of 5 variables:
## $ n : num 1 1 1 1 4
## $ % : num 25 25 25 25 100
## $ val% : num 25 25 25 25 100
## $ %cum : num 25 50 75 100 100
## $ val%cum: num 25 50 75 100 100
x <- row.names(table)
y <- table$n
names <- x[1:(length(x)-1)]
freqs <- y[1:(length(y)-1)]
df_mh <- data.frame(x = names, y = freqs)
knitr::kable(df_mh)
| x | y |
|---|---|
| 1.69508 | 1 |
| 3.36905 | 1 |
| 3.4274 | 1 |
| 4.18059 | 1 |
library(ggplot2)
ggplot(data=df_mh, aes(x=x, y=y)) +
geom_bar(stat="identity", color="white", fill="blue") +
xlab("Rango de deslizamiento") +
ylab("Frecuencia")
n_sturges = 1 + log(length(Distance))/log(2)
n_sturgesc = ceiling(n_sturges)
n_sturgesf = floor(n_sturges)
n_clases = 0
if (n_sturgesc%%2 == 0) {
n_clases = n_sturgesf
} else {
n_clases = n_sturgesc
}
R = max(Distance) - min(Distance)
w = ceiling(R/n_clases)
bins <- seq(min(Distance), max(Distance) + w, by = w)
bins
## [1] 1.69508 2.69508 3.69508 4.69508
Edades <- cut(Distance, bins)
Freq_table <- transform(table(Distance), Rel_Freq=prop.table(Freq), Cum_Freq=cumsum(Freq))
knitr::kable(Freq_table)
| Distance | Freq | Rel_Freq | Cum_Freq |
|---|---|---|---|
| 1.69508 | 1 | 0.25 | 1 |
| 3.36905 | 1 | 0.25 | 2 |
| 3.4274 | 1 | 0.25 | 3 |
| 4.18059 | 1 | 0.25 | 4 |
str(Freq_table)
## 'data.frame': 4 obs. of 4 variables:
## $ Distance: Factor w/ 4 levels "1.69508","3.36905",..: 1 2 3 4
## $ Freq : int 1 1 1 1
## $ Rel_Freq: num 0.25 0.25 0.25 0.25
## $ Cum_Freq: int 1 2 3 4
df_mh <- data.frame(x = Freq_table$Distance, y = Freq_table$Freq)
knitr::kable(df_mh)
| x | y |
|---|---|
| 1.69508 | 1 |
| 3.36905 | 1 |
| 3.4274 | 1 |
| 4.18059 | 1 |
library(ggplot2)
ggplot(data=df_mh, aes(x=x, y=y)) +
geom_bar(stat="identity", color="blue", fill="green") +
xlab("Rango de Distance") +
ylab("Frecuencia")
Estos se encargan de la toma de datos cuantitativa con respecto a la información proporcionada, los datos se calculan a partir de la media, mediana, moda, cuartiles etc.
summary(df_mh$Distance)
## Length Class Mode
## 0 NULL NULL
library(pastecs)
stat.desc(df_mh)
## x y
## nbr.val NA 4
## nbr.null NA 0
## nbr.na NA 0
## min NA 1
## max NA 1
## range NA 0
## sum NA 4
## median NA 1
## mean NA 1
## SE.mean NA 0
## CI.mean NA 0
## var NA 0
## std.dev NA 0
## coef.var NA 0
boxplot(Distance, horizontal=TRUE, col='steelblue')
library(readr)
library(knitr)
df_mx <- subset (df, Country == "Mexico")
knitr::kable(head(df_mx))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 13 | 115 | 7/4/07 | NA | Mexico | MX | Veracruz-Llave | 1947 | Laguna Chica (Pueblo Nuevo) | 9.51003 | 18.5369 | -96.8229 | (18.536899999999999, -96.822900000000004) | Landslide | Landslide | Medium | Rain | NA | 7 | nytimes.com | http://www.nytimes.com/2007/07/04/world/americas/04cnd-mexico.html?_r=1&hp&oref=slogin | |||
| 29 | 201 | 8/23/07 | NA | Mexico | MX | Puebla | 1414 | Xochitlaxco (San Baltazar) | 1.68294 | 19.9333 | -97.8500 | (19.933299999999999, -97.85) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Dean | NA | 6 | Inquirer.com | http://newsinfo.inquirer.net/breakingnews/world/view_article.php?article_id=84452 | ||
| 31 | 225 | 9/2/07 | NA | Mexico | MX | Sinaloa | 3191 | El Limón de los Ramos | 10.88351 | 24.9531 | -107.6220 | (24.953099999999999, -107.622) | Landslide | Complex | Medium | Tropical cyclone | Tropical Storm Henrietta | NA | 3 | ||||
| 42 | 284 | 9/28/07 | NA | Mexico | MX | Puebla | 3761 | Xaltepuxtla | 7.93258 | 20.2000 | -97.9000 | (20.2, -97.9) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Lorenzo | NA | 1 | PressTV.ir | http://www.presstv.ir/detail.aspx?id=25037§ionid=3510207 | ||
| 57 | 342 | 10/31/07 | NA | Mexico | MX | Tabasco | 4468 | Buenavista | 4.19108 | 17.9493 | -92.5534 | (17.949300000000001, -92.553399999999996) | Landslide | Landslide | Medium | Rain | NA | 18 | CapeTimes | http://www.capetimes.co.za/?fArticleId=4109453 | |||
| 59 | 346 | 11/4/07 | NA | Mexico | MX | Chiapas | 3183 | Ostuacán | 3.74149 | 17.3900 | -93.3060 | (17.39, -93.305999999999997) | Landslide | Mudslide | Very_large | Rain | NA | 5 | Reuters - AlertNet.org | http://news.monstersandcritics.com/americas/news/article_1371436.php/Mudslide_is_latest_disaster_for_hard-hit_Mexico__2nd_Roundup_ |
library(readr)
library(knitr)
df_oa <- subset (df, State == "Oaxaca")
df_oa %>%
select(Country, State, City, Distance)
## Country State City Distance
## 422 Mexico Oaxaca Santiago Choapam 16.16369
## 423 Mexico Oaxaca Santa María la Asunción 0.63550
## 457 Mexico Oaxaca Santo Domingo Tepuxtepec 15.74984
## 467 Mexico Oaxaca Tanetze de Zaragoza 24.67589
## 787 Mexico Oaxaca Salina Cruz 0.78340
## 788 Mexico Oaxaca San José Chiltepec 0.28905
## 789 Mexico Oaxaca Paso Real de Sarabia 9.56829
## 890 Mexico Oaxaca Oaxaca 3.64682
## 1147 Mexico Oaxaca San Andrés Huayapam 11.83490
library(ggplot2)
ggplot(data=df_oa, aes(x= State , y= Distance)) + geom_bar(stat="identity", color="black", fill="green")
library(ggplot2)
library(dplyr)
ggplot(data=df_oa, aes(fill=City, x="Oaxaca", y=Distance)) +
geom_bar(position="dodge", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_oa, aes(fill=City, x="Oaxaca", y=Distance)) +
geom_bar(position="stack", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_oa, aes(x = "Oaxaca", y = Distance , fill=City)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y", start = 0)
library(ggplot2)
library(dplyr)
df_oa <- df_oa %>%
arrange(desc(City)) %>%
mutate(prop = Distance / sum(df_oa$Distance) *100) %>%
mutate(ypos = cumsum(prop)- 0.5*prop )
require(scales)
ggplot(df_oa, aes(x= State, y = prop, fill=City)) +
geom_bar(stat="identity", width=1, color="black") +
coord_polar("y", start=0) +
theme_void() +
theme(legend.position="none") +
geom_text(aes(y = ypos, label = percent(prop/100)), color = "black", size=3) +
scale_fill_brewer(palette="Set4")
## Warning in pal_name(palette, type): Unknown palette Set4
library(qcc)
Distance <- df_oa$Distance
names(Distance) <- df_oa$City
pareto.chart(Distance,
ylab="Distance",
col = heat.colors(length(Distance)),
cumperc = seq(0, 100, by = 10),
ylab2 = "Porcentaje acumulado",
main = "DONDE SE CONCENTRAN LAS CIUDADES CON MAYORES DESLIZAMIENTOS")
##
## Pareto chart analysis for Distance
## Frequency Cum.Freq. Percentage Cum.Percent.
## Tanetze de Zaragoza 24.6758900 24.6758900 29.6060776 29.6060776
## Santiago Choapam 16.1636900 40.8395800 19.3931591 48.9992367
## Santo Domingo Tepuxtepec 15.7498400 56.5894200 18.8966228 67.8958595
## San Andrés Huayapam 11.8349000 68.4243200 14.1994865 82.0953460
## Paso Real de Sarabia 9.5682900 77.9926100 11.4800129 93.5753589
## Oaxaca 3.6468200 81.6394300 4.3754465 97.9508054
## Salina Cruz 0.7834000 82.4228300 0.9399216 98.8907270
## Santa María la Asunción 0.6355000 83.0583300 0.7624715 99.6531985
## San José Chiltepec 0.2890500 83.3473800 0.3468015 100.0000000
stem(df_oa$"Distance")
##
## The decimal point is 1 digit(s) to the right of the |
##
## 0 | 0114
## 0 |
## 1 | 02
## 1 | 66
## 2 |
## 2 | 5
head(df_oa)
## id date time continent_code Country country_code State population
## 1 2524 9/30/10 Morning <NA> Mexico MX Oaxaca 1096
## 2 2514 9/28/10 4:00:00 <NA> Mexico MX Oaxaca 1813
## 3 2321 8/24/10 Morning <NA> Mexico MX Oaxaca 1099
## 4 2322 8/24/10 Morning <NA> Mexico MX Oaxaca 1701
## 5 3796 7/17/11 <NA> Mexico MX Oaxaca 3294
## 6 5526 9/14/13 <NA> Mexico MX Oaxaca 3630
## City Distance location_description latitude longitude
## 1 Tanetze de Zaragoza 24.67589 17.1833 -96.1833
## 2 Santo Domingo Tepuxtepec 15.74984 17.0977 -96.0625
## 3 Santiago Choapam 16.16369 17.2568 -96.0289
## 4 Santa María la Asunción 0.63550 18.1060 -96.8133
## 5 San José Chiltepec 0.28905 17.9484 -96.1674
## 6 San Andrés Huayapam 11.83490 17.1933 -96.6045
## geolocation hazard_type landslide_type
## 1 (17.183299999999999, -96.183300000000003) Landslide Mudslide
## 2 (17.0977, -96.0625) Landslide Mudslide
## 3 (17.256799999999998, -96.028899999999993) Landslide Mudslide
## 4 (18.106000000000002, -96.813299999999998) Landslide Mudslide
## 5 (17.948399999999999, -96.167400000000001) Landslide Mudslide
## 6 (17.193300000000001, -96.604500000000002) Landslide Landslide
## landslide_size trigger storm_name
## 1 Medium Tropical cyclone Hurricane Karl and Tropical Storm Matthew
## 2 Medium Tropical cyclone Hurricane Karl and Tropical Storm Matthew
## 3 Medium Tropical cyclone Hurricane Frank
## 4 Medium Tropical cyclone Hurricane Frank
## 5 Medium Downpour
## 6 Very_large Tropical cyclone Ingrid
## injuries fatalities source_name
## 1 NA 2
## 2 NA 11
## 3 NA 2
## 4 NA 2
## 5 NA 0
## 6 NA 1 www.recordonline.com
## source_link
## 1 http://technews.tmcnet.com/topics/associated-press/articles/106209-death-toll-southern-mexico-mudslides-up-32.htm
## 2 http://technews.tmcnet.com/topics/associated-press/articles/106209-death-toll-southern-mexico-mudslides-up-32.htm
## 3
## 4
## 5 http://www.thenews.com.pk/NewsDetail.aspx?ID=18895&title=Intense-rains-in-Mexico-affect-thousands
## 6 http://www.recordonline.com/apps/pbcs.dll/article?AID=/20130915/NEWS/130919814/-1/SITEMAP
## prop ypos
## 1 29.6060776 14.80304
## 2 18.8966228 39.05439
## 3 19.3931591 58.19928
## 4 0.7624715 68.27710
## 5 0.3468015 68.83173
## 6 14.1994865 76.10488
knitr::kable(head(df_oa))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | prop | ypos |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2524 | 9/30/10 | Morning | NA | Mexico | MX | Oaxaca | 1096 | Tanetze de Zaragoza | 24.67589 | 17.1833 | -96.1833 | (17.183299999999999, -96.183300000000003) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Karl and Tropical Storm Matthew | NA | 2 | http://technews.tmcnet.com/topics/associated-press/articles/106209-death-toll-southern-mexico-mudslides-up-32.htm | 29.6060776 | 14.80304 | ||
| 2514 | 9/28/10 | 4:00:00 | NA | Mexico | MX | Oaxaca | 1813 | Santo Domingo Tepuxtepec | 15.74984 | 17.0977 | -96.0625 | (17.0977, -96.0625) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Karl and Tropical Storm Matthew | NA | 11 | http://technews.tmcnet.com/topics/associated-press/articles/106209-death-toll-southern-mexico-mudslides-up-32.htm | 18.8966228 | 39.05439 | ||
| 2321 | 8/24/10 | Morning | NA | Mexico | MX | Oaxaca | 1099 | Santiago Choapam | 16.16369 | 17.2568 | -96.0289 | (17.256799999999998, -96.028899999999993) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Frank | NA | 2 | 19.3931591 | 58.19928 | |||
| 2322 | 8/24/10 | Morning | NA | Mexico | MX | Oaxaca | 1701 | Santa María la Asunción | 0.63550 | 18.1060 | -96.8133 | (18.106000000000002, -96.813299999999998) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Frank | NA | 2 | 0.7624715 | 68.27710 | |||
| 3796 | 7/17/11 | NA | Mexico | MX | Oaxaca | 3294 | San José Chiltepec | 0.28905 | 17.9484 | -96.1674 | (17.948399999999999, -96.167400000000001) | Landslide | Mudslide | Medium | Downpour | NA | 0 | http://www.thenews.com.pk/NewsDetail.aspx?ID=18895&title=Intense-rains-in-Mexico-affect-thousands | 0.3468015 | 68.83173 | ||||
| 5526 | 9/14/13 | NA | Mexico | MX | Oaxaca | 3630 | San Andrés Huayapam | 11.83490 | 17.1933 | -96.6045 | (17.193300000000001, -96.604500000000002) | Landslide | Landslide | Very_large | Tropical cyclone | Ingrid | NA | 1 | www.recordonline.com | http://www.recordonline.com/apps/pbcs.dll/article?AID=/20130915/NEWS/130919814/-1/SITEMAP | 14.1994865 | 76.10488 |
stem(df_oa$"Distance")
##
## The decimal point is 1 digit(s) to the right of the |
##
## 0 | 0114
## 0 |
## 1 | 02
## 1 | 66
## 2 |
## 2 | 5
stem(df_oa$"Distance", scale = 2)
##
## The decimal point is 1 digit(s) to the right of the |
##
## 0 | 0114
## 0 |
## 1 | 02
## 1 | 66
## 2 |
## 2 | 5
library(forecast)
data<- ts(df_oa$Distance, frequency=12, start=2008)
knitr::kable(head(data))
| x |
|---|
| 24.67589 |
| 15.74984 |
| 16.16369 |
| 0.63550 |
| 0.28905 |
| 11.83490 |
autoplot(data) + labs(title = "Gráfico de series temporales", x="date", y = "distancia", colour = "green") +theme_bw()
library(questionr)
table <- questionr::freq(Distance, cum = TRUE, sort = "dec", total = TRUE)
knitr::kable(table)
| n | % | val% | %cum | val%cum | |
|---|---|---|---|---|---|
| 0.28905 | 1 | 11.1 | 11.1 | 11.1 | 11.1 |
| 0.6355 | 1 | 11.1 | 11.1 | 22.2 | 22.2 |
| 0.7834 | 1 | 11.1 | 11.1 | 33.3 | 33.3 |
| 3.64682 | 1 | 11.1 | 11.1 | 44.4 | 44.4 |
| 9.56829 | 1 | 11.1 | 11.1 | 55.6 | 55.6 |
| 11.8349 | 1 | 11.1 | 11.1 | 66.7 | 66.7 |
| 15.74984 | 1 | 11.1 | 11.1 | 77.8 | 77.8 |
| 16.16369 | 1 | 11.1 | 11.1 | 88.9 | 88.9 |
| 24.67589 | 1 | 11.1 | 11.1 | 100.0 | 100.0 |
| Total | 9 | 100.0 | 100.0 | 100.0 | 100.0 |
str(table)
## Classes 'freqtab' and 'data.frame': 10 obs. of 5 variables:
## $ n : num 1 1 1 1 1 1 1 1 1 9
## $ % : num 11.1 11.1 11.1 11.1 11.1 11.1 11.1 11.1 11.1 100
## $ val% : num 11.1 11.1 11.1 11.1 11.1 11.1 11.1 11.1 11.1 100
## $ %cum : num 11.1 22.2 33.3 44.4 55.6 66.7 77.8 88.9 100 100
## $ val%cum: num 11.1 22.2 33.3 44.4 55.6 66.7 77.8 88.9 100 100
x <- row.names(table)
y <- table$n
names <- x[1:(length(x)-1)]
freqs <- y[1:(length(y)-1)]
df_oa <- data.frame(x = names, y = freqs)
knitr::kable(df_oa)
| x | y |
|---|---|
| 0.28905 | 1 |
| 0.6355 | 1 |
| 0.7834 | 1 |
| 3.64682 | 1 |
| 9.56829 | 1 |
| 11.8349 | 1 |
| 15.74984 | 1 |
| 16.16369 | 1 |
| 24.67589 | 1 |
library(ggplot2)
ggplot(data=df_oa, aes(x=x, y=y)) +
geom_bar(stat="identity", color="white", fill="blue") +
xlab("Rango de deslizamiento") +
ylab("Frecuencia")
n_sturges = 1 + log(length(Distance))/log(2)
n_sturgesc = ceiling(n_sturges)
n_sturgesf = floor(n_sturges)
n_clases = 0
if (n_sturgesc%%2 == 0) {
n_clases = n_sturgesf
} else {
n_clases = n_sturgesc
}
R = max(Distance) - min(Distance)
w = ceiling(R/n_clases)
bins <- seq(min(Distance), max(Distance) + w, by = w)
bins
## [1] 0.28905 5.28905 10.28905 15.28905 20.28905 25.28905
Edades <- cut(Distance, bins)
Freq_table <- transform(table(Distance), Rel_Freq=prop.table(Freq), Cum_Freq=cumsum(Freq))
knitr::kable(Freq_table)
| Distance | Freq | Rel_Freq | Cum_Freq |
|---|---|---|---|
| 0.28905 | 1 | 0.1111111 | 1 |
| 0.6355 | 1 | 0.1111111 | 2 |
| 0.7834 | 1 | 0.1111111 | 3 |
| 3.64682 | 1 | 0.1111111 | 4 |
| 9.56829 | 1 | 0.1111111 | 5 |
| 11.8349 | 1 | 0.1111111 | 6 |
| 15.74984 | 1 | 0.1111111 | 7 |
| 16.16369 | 1 | 0.1111111 | 8 |
| 24.67589 | 1 | 0.1111111 | 9 |
str(Freq_table)
## 'data.frame': 9 obs. of 4 variables:
## $ Distance: Factor w/ 9 levels "0.28905","0.6355",..: 1 2 3 4 5 6 7 8 9
## $ Freq : int 1 1 1 1 1 1 1 1 1
## $ Rel_Freq: num 0.111 0.111 0.111 0.111 0.111 ...
## $ Cum_Freq: int 1 2 3 4 5 6 7 8 9
df_oa <- data.frame(x = Freq_table$Distance, y = Freq_table$Freq)
knitr::kable(df_oa)
| x | y |
|---|---|
| 0.28905 | 1 |
| 0.6355 | 1 |
| 0.7834 | 1 |
| 3.64682 | 1 |
| 9.56829 | 1 |
| 11.8349 | 1 |
| 15.74984 | 1 |
| 16.16369 | 1 |
| 24.67589 | 1 |
library(ggplot2)
ggplot(data=df_oa, aes(x=x, y=y)) +
geom_bar(stat="identity", color="blue", fill="green") +
xlab("Rango de Distance") +
ylab("Frecuencia")
Estos se encargan de la toma de datos cuantitativa con respecto a la información proporcionada, los datos se calculan a partir de la media, mediana, moda, cuartiles etc.
summary(df_oa$Distance)
## Length Class Mode
## 0 NULL NULL
library(pastecs)
stat.desc(df_oa)
## x y
## nbr.val NA 9
## nbr.null NA 0
## nbr.na NA 0
## min NA 1
## max NA 1
## range NA 0
## sum NA 9
## median NA 1
## mean NA 1
## SE.mean NA 0
## CI.mean NA 0
## var NA 0
## std.dev NA 0
## coef.var NA 0
boxplot(Distance, horizontal=TRUE, col='steelblue')
library(readr)
library(knitr)
df_mx <- subset (df, Country == "Mexico")
knitr::kable(head(df_mx))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 13 | 115 | 7/4/07 | NA | Mexico | MX | Veracruz-Llave | 1947 | Laguna Chica (Pueblo Nuevo) | 9.51003 | 18.5369 | -96.8229 | (18.536899999999999, -96.822900000000004) | Landslide | Landslide | Medium | Rain | NA | 7 | nytimes.com | http://www.nytimes.com/2007/07/04/world/americas/04cnd-mexico.html?_r=1&hp&oref=slogin | |||
| 29 | 201 | 8/23/07 | NA | Mexico | MX | Puebla | 1414 | Xochitlaxco (San Baltazar) | 1.68294 | 19.9333 | -97.8500 | (19.933299999999999, -97.85) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Dean | NA | 6 | Inquirer.com | http://newsinfo.inquirer.net/breakingnews/world/view_article.php?article_id=84452 | ||
| 31 | 225 | 9/2/07 | NA | Mexico | MX | Sinaloa | 3191 | El Limón de los Ramos | 10.88351 | 24.9531 | -107.6220 | (24.953099999999999, -107.622) | Landslide | Complex | Medium | Tropical cyclone | Tropical Storm Henrietta | NA | 3 | ||||
| 42 | 284 | 9/28/07 | NA | Mexico | MX | Puebla | 3761 | Xaltepuxtla | 7.93258 | 20.2000 | -97.9000 | (20.2, -97.9) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Lorenzo | NA | 1 | PressTV.ir | http://www.presstv.ir/detail.aspx?id=25037§ionid=3510207 | ||
| 57 | 342 | 10/31/07 | NA | Mexico | MX | Tabasco | 4468 | Buenavista | 4.19108 | 17.9493 | -92.5534 | (17.949300000000001, -92.553399999999996) | Landslide | Landslide | Medium | Rain | NA | 18 | CapeTimes | http://www.capetimes.co.za/?fArticleId=4109453 | |||
| 59 | 346 | 11/4/07 | NA | Mexico | MX | Chiapas | 3183 | Ostuacán | 3.74149 | 17.3900 | -93.3060 | (17.39, -93.305999999999997) | Landslide | Mudslide | Very_large | Rain | NA | 5 | Reuters - AlertNet.org | http://news.monstersandcritics.com/americas/news/article_1371436.php/Mudslide_is_latest_disaster_for_hard-hit_Mexico__2nd_Roundup_ |
library(readr)
library(knitr)
df_ny <- subset (df, State == "Nayarit")
df_ny %>%
select(Country, State, City, Distance)
## Country State City Distance
## 761 Mexico Nayarit La Jarretadera 21.80060
## 802 Mexico Nayarit Puga 19.41353
library(ggplot2)
ggplot(data=df_ny, aes(x= State , y= Distance)) + geom_bar(stat="identity", color="black", fill="green")
library(ggplot2)
library(dplyr)
ggplot(data=df_ny, aes(fill=City, x="Nayarit", y=Distance)) +
geom_bar(position="dodge", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_ny, aes(fill=City, x="Nayarit", y=Distance)) +
geom_bar(position="stack", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_ny, aes(x = "Nayarit", y = Distance , fill=City)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y", start = 0)
library(ggplot2)
library(dplyr)
df_ny <- df_ny %>%
arrange(desc(City)) %>%
mutate(prop = Distance / sum(df_ny$Distance) *100) %>%
mutate(ypos = cumsum(prop)- 0.5*prop )
require(scales)
ggplot(df_ny, aes(x= State, y = prop, fill=City)) +
geom_bar(stat="identity", width=1, color="black") +
coord_polar("y", start=0) +
theme_void() +
theme(legend.position="none") +
geom_text(aes(y = ypos, label = percent(prop/100)), color = "black", size=3) +
scale_fill_brewer(palette="Set4")
## Warning in pal_name(palette, type): Unknown palette Set4
library(qcc)
Distance <- df_ny$Distance
names(Distance) <- df_mh$City
pareto.chart(Distance,
ylab="Distance",
col = heat.colors(length(Distance)),
cumperc = seq(0, 100, by = 10),
ylab2 = "Porcentaje acumulado",
main = "DONDE SE CONCENTRAN LAS CIUDADES CON MAYORES DESLIZAMIENTOS")
##
## Pareto chart analysis for Distance
## Frequency Cum.Freq. Percentage Cum.Percent.
## B 21.80060 21.80060 52.89594 52.89594
## A 19.41353 41.21413 47.10406 100.00000
stem(df_ny$"Distance")
##
## The decimal point is at the |
##
## 19 | 4
## 19 |
## 20 |
## 20 |
## 21 |
## 21 | 8
head(df_ny)
## id date time continent_code Country country_code State population
## 1 3836 7/22/11 <NA> Mexico MX Nayarit 6361
## 2 3639 6/22/11 <NA> Mexico MX Nayarit 4463
## City Distance location_description latitude longitude
## 1 Puga 19.41353 21.7595 -104.8334
## 2 La Jarretadera 21.80060 21.9814 -104.8381
## geolocation hazard_type landslide_type landslide_size
## 1 (21.759499999999999, -104.8334) Landslide Landslide Medium
## 2 (21.981400000000001, -104.8381) Landslide Landslide Medium
## trigger storm_name injuries fatalities source_name
## 1 Tropical cyclone Hurricane Dora NA 0
## 2 Tropical cyclone Hurricane Beatriz NA 0
## source_link
## 1
## 2 http://channel6newsonline.com/2011/06/missing-teen-found-dead-after-beatriz-slams-mexicos-pacific-coast/
## prop ypos
## 1 47.10406 23.55203
## 2 52.89594 73.55203
knitr::kable(head(df_ny))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | prop | ypos |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 3836 | 7/22/11 | NA | Mexico | MX | Nayarit | 6361 | Puga | 19.41353 | 21.7595 | -104.8334 | (21.759499999999999, -104.8334) | Landslide | Landslide | Medium | Tropical cyclone | Hurricane Dora | NA | 0 | 47.10406 | 23.55203 | ||||
| 3639 | 6/22/11 | NA | Mexico | MX | Nayarit | 4463 | La Jarretadera | 21.80060 | 21.9814 | -104.8381 | (21.981400000000001, -104.8381) | Landslide | Landslide | Medium | Tropical cyclone | Hurricane Beatriz | NA | 0 | http://channel6newsonline.com/2011/06/missing-teen-found-dead-after-beatriz-slams-mexicos-pacific-coast/ | 52.89594 | 73.55203 |
stem(df_ny$"Distance")
##
## The decimal point is at the |
##
## 19 | 4
## 19 |
## 20 |
## 20 |
## 21 |
## 21 | 8
stem(df_ny$"Distance", scale = 2)
##
## The decimal point is at the |
##
## 19 | 4
## 19 |
## 20 |
## 20 |
## 21 |
## 21 | 8
library(forecast)
data<- ts(df_ny$Distance, frequency=12, start=2008)
knitr::kable(head(data))
| x |
|---|
| 19.41353 |
| 21.80060 |
autoplot(data) + labs(title = "Gráfico de series temporales", x="date", y = "distancia", colour = "green") +theme_bw()
library(questionr)
table <- questionr::freq(Distance, cum = TRUE, sort = "dec", total = TRUE)
knitr::kable(table)
| n | % | val% | %cum | val%cum | |
|---|---|---|---|---|---|
| 19.41353 | 1 | 50 | 50 | 50 | 50 |
| 21.8006 | 1 | 50 | 50 | 100 | 100 |
| Total | 2 | 100 | 100 | 100 | 100 |
str(table)
## Classes 'freqtab' and 'data.frame': 3 obs. of 5 variables:
## $ n : num 1 1 2
## $ % : num 50 50 100
## $ val% : num 50 50 100
## $ %cum : num 50 100 100
## $ val%cum: num 50 100 100
x <- row.names(table)
y <- table$n
names <- x[1:(length(x)-1)]
freqs <- y[1:(length(y)-1)]
df_ny <- data.frame(x = names, y = freqs)
knitr::kable(df_ny)
| x | y |
|---|---|
| 19.41353 | 1 |
| 21.8006 | 1 |
library(ggplot2)
ggplot(data=df_ny, aes(x=x, y=y)) +
geom_bar(stat="identity", color="white", fill="blue") +
xlab("Rango de deslizamiento") +
ylab("Frecuencia")
n_sturges = 1 + log(length(Distance))/log(2)
n_sturgesc = ceiling(n_sturges)
n_sturgesf = floor(n_sturges)
n_clases = 0
if (n_sturgesc%%2 == 0) {
n_clases = n_sturgesf
} else {
n_clases = n_sturgesc
}
R = max(Distance) - min(Distance)
w = ceiling(R/n_clases)
bins <- seq(min(Distance), max(Distance) + w, by = w)
bins
## [1] 19.41353 21.41353 23.41353
Edades <- cut(Distance, bins)
Freq_table <- transform(table(Distance), Rel_Freq=prop.table(Freq), Cum_Freq=cumsum(Freq))
knitr::kable(Freq_table)
| Distance | Freq | Rel_Freq | Cum_Freq |
|---|---|---|---|
| 19.41353 | 1 | 0.5 | 1 |
| 21.8006 | 1 | 0.5 | 2 |
str(Freq_table)
## 'data.frame': 2 obs. of 4 variables:
## $ Distance: Factor w/ 2 levels "19.41353","21.8006": 1 2
## $ Freq : int 1 1
## $ Rel_Freq: num 0.5 0.5
## $ Cum_Freq: int 1 2
df_ny <- data.frame(x = Freq_table$Distance, y = Freq_table$Freq)
knitr::kable(df_ny)
| x | y |
|---|---|
| 19.41353 | 1 |
| 21.8006 | 1 |
library(ggplot2)
ggplot(data=df_ny, aes(x=x, y=y)) +
geom_bar(stat="identity", color="blue", fill="green") +
xlab("Rango de Distance") +
ylab("Frecuencia")
Estos se encargan de la toma de datos cuantitativa con respecto a la información proporcionada, los datos se calculan a partir de la media, mediana, moda, cuartiles etc.
summary(df_ny$Distance)
## Length Class Mode
## 0 NULL NULL
library(pastecs)
stat.desc(df_ny)
## x y
## nbr.val NA 2
## nbr.null NA 0
## nbr.na NA 0
## min NA 1
## max NA 1
## range NA 0
## sum NA 2
## median NA 1
## mean NA 1
## SE.mean NA 0
## CI.mean NA 0
## var NA 0
## std.dev NA 0
## coef.var NA 0
boxplot(Distance, horizontal=TRUE, col='steelblue')
library(readr)
library(knitr)
df_mx <- subset (df, Country == "Mexico")
knitr::kable(head(df_mx))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 13 | 115 | 7/4/07 | NA | Mexico | MX | Veracruz-Llave | 1947 | Laguna Chica (Pueblo Nuevo) | 9.51003 | 18.5369 | -96.8229 | (18.536899999999999, -96.822900000000004) | Landslide | Landslide | Medium | Rain | NA | 7 | nytimes.com | http://www.nytimes.com/2007/07/04/world/americas/04cnd-mexico.html?_r=1&hp&oref=slogin | |||
| 29 | 201 | 8/23/07 | NA | Mexico | MX | Puebla | 1414 | Xochitlaxco (San Baltazar) | 1.68294 | 19.9333 | -97.8500 | (19.933299999999999, -97.85) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Dean | NA | 6 | Inquirer.com | http://newsinfo.inquirer.net/breakingnews/world/view_article.php?article_id=84452 | ||
| 31 | 225 | 9/2/07 | NA | Mexico | MX | Sinaloa | 3191 | El Limón de los Ramos | 10.88351 | 24.9531 | -107.6220 | (24.953099999999999, -107.622) | Landslide | Complex | Medium | Tropical cyclone | Tropical Storm Henrietta | NA | 3 | ||||
| 42 | 284 | 9/28/07 | NA | Mexico | MX | Puebla | 3761 | Xaltepuxtla | 7.93258 | 20.2000 | -97.9000 | (20.2, -97.9) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Lorenzo | NA | 1 | PressTV.ir | http://www.presstv.ir/detail.aspx?id=25037§ionid=3510207 | ||
| 57 | 342 | 10/31/07 | NA | Mexico | MX | Tabasco | 4468 | Buenavista | 4.19108 | 17.9493 | -92.5534 | (17.949300000000001, -92.553399999999996) | Landslide | Landslide | Medium | Rain | NA | 18 | CapeTimes | http://www.capetimes.co.za/?fArticleId=4109453 | |||
| 59 | 346 | 11/4/07 | NA | Mexico | MX | Chiapas | 3183 | Ostuacán | 3.74149 | 17.3900 | -93.3060 | (17.39, -93.305999999999997) | Landslide | Mudslide | Very_large | Rain | NA | 5 | Reuters - AlertNet.org | http://news.monstersandcritics.com/americas/news/article_1371436.php/Mudslide_is_latest_disaster_for_hard-hit_Mexico__2nd_Roundup_ |
library(readr)
library(knitr)
df_gr <- subset (df, State == "Guerrero")
df_gr %>%
select(Country, State, City, Distance)
## Country State City Distance
## 800 Mexico Guerrero Chilpancingo de los Bravos 6.80950
## 1151 Mexico Guerrero Acapulco 0.90692
## 1153 Mexico Guerrero Atoyac de Álvarez 32.12708
## 1154 Mexico Guerrero San Pablo Atzompa 14.04274
## 1159 Mexico Guerrero Chilpancingo de los Bravos 0.88149
## 1298 Mexico Guerrero Colonia Alborada 4.10830
## 1621 Mexico Guerrero Acapulco de Juárez 7.07138
## 1635 Mexico Guerrero Pochutla 12.33417
library(ggplot2)
ggplot(data=df_gr, aes(x= State , y= Distance)) + geom_bar(stat="identity", color="black", fill="green")
library(ggplot2)
library(dplyr)
ggplot(data=df_gr, aes(fill=City, x="Guerrero", y=Distance)) +
geom_bar(position="dodge", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_gr, aes(fill=City, x="Guerrero", y=Distance)) +
geom_bar(position="stack", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_gr, aes(x = "Guerrero", y = Distance , fill=City)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y", start = 0)
library(ggplot2)
library(dplyr)
df_gr <- df_gr %>%
arrange(desc(City)) %>%
mutate(prop = Distance / sum(df_gr$Distance) *100) %>%
mutate(ypos = cumsum(prop)- 0.5*prop )
require(scales)
ggplot(df_gr, aes(x= State, y = prop, fill=City)) +
geom_bar(stat="identity", width=1, color="black") +
coord_polar("y", start=0) +
theme_void() +
theme(legend.position="none") +
geom_text(aes(y = ypos, label = percent(prop/100)), color = "black", size=3) +
scale_fill_brewer(palette="Set4")
## Warning in pal_name(palette, type): Unknown palette Set4
library(qcc)
Distance <- df_gr$Distance
names(Distance) <- df_gr$City
pareto.chart(Distance,
ylab="Distance",
col = heat.colors(length(Distance)),
cumperc = seq(0, 100, by = 10),
ylab2 = "Porcentaje acumulado",
main = "DONDE SE CONCENTRAN LAS CIUDADES CON MAYORES DESLIZAMIENTOS")
##
## Pareto chart analysis for Distance
## Frequency Cum.Freq. Percentage Cum.Percent.
## Atoyac de Álvarez 32.127080 32.127080 41.040408 41.040408
## San Pablo Atzompa 14.042740 46.169820 17.938754 58.979162
## Pochutla 12.334170 58.503990 15.756159 74.735321
## Acapulco de Juárez 7.071380 65.575370 9.033262 83.768583
## Chilpancingo de los Bravos 6.809500 72.384870 8.698726 92.467308
## Colonia Alborada 4.108300 76.493170 5.248106 97.715414
## Acapulco 0.906920 77.400090 1.158536 98.873950
## Chilpancingo de los Bravos 0.881490 78.281580 1.126050 100.000000
stem(df_gr$"Distance")
##
## The decimal point is 1 digit(s) to the right of the |
##
## 0 | 11477
## 1 | 24
## 2 |
## 3 | 2
head(df_gr)
## id date time continent_code Country country_code State population
## 1 5538 9/16/13 <NA> Mexico MX Guerrero 1252
## 2 7479 10/3/15 Night <NA> Mexico MX Guerrero 1201
## 3 6269 10/18/14 <NA> Mexico MX Guerrero 1018
## 4 3834 7/22/11 <NA> Mexico MX Guerrero 165250
## 5 5543 9/16/13 <NA> Mexico MX Guerrero 165250
## 6 5534 9/16/13 15:30 <NA> Mexico MX Guerrero 21407
## City Distance location_description latitude longitude
## 1 San Pablo Atzompa 14.04274 17.2250 -98.5000
## 2 Pochutla 12.33417 Unknown 17.5586 -98.9483
## 3 Colonia Alborada 4.10830 Above road 16.8850 -99.8562
## 4 Chilpancingo de los Bravos 6.80950 17.4974 -99.5380
## 5 Chilpancingo de los Bravos 0.88149 17.5482 -99.5137
## 6 Atoyac de Álvarez 32.12708 Deforested slope 17.3461 -100.1681
## geolocation hazard_type landslide_type
## 1 (17.225000000000001, -98.5) Landslide Landslide
## 2 (17.558599999999998, -98.948300000000003) Landslide Landslide
## 3 (16.885000000000002, -99.856200000000001) Landslide Landslide
## 4 (17.497399999999999, -99.537999999999997) Landslide Landslide
## 5 (17.548200000000001, -99.5137) Landslide Mudslide
## 6 (17.3461, -100.1681) Landslide Mudslide
## landslide_size trigger storm_name injuries fatalities
## 1 Medium Downpour NA 0
## 2 Medium Tropical cyclone Marty 0 0
## 3 Small Tropical cyclone Trudy 0 0
## 4 Medium Tropical cyclone Hurricane Dora NA 0
## 5 Medium Tropical cyclone Ingrid NA 4
## 6 Medium Tropical cyclone Manuel 4 71
## source_name
## 1 america.aljazeera.com
## 2 Tiempo
## 3 Thomson Reuters Foundation
## 4
## 5 www.washingtonpost.com
## 6 Vice News
## source_link
## 1 http://america.aljazeera.com/articles/2013/11/19/after-landslide-poorestofthepoorleftoutinthecoldinmexico.html
## 2 http://www.tiempoenlinea.com.mx/index.php/oaxaca-2/52715-deslave-afecta-62-viviendas-en-la-montana-de-guerrero
## 3 http://www.trust.org/item/20141018173449-r3rca/
## 4
## 5 http://www.washingtonpost.com/world/two-storms-batter-mexico-killing-dozens/2013/09/17/5cd3d81e-1f8e-11e3-b7d1-7153ad47b549_gallery.html#photo=6
## 6 https://news.vice.com/article/a-mexican-town-mourns-its-missing-one-year-after-being-engulfed-by-mud
## prop ypos
## 1 17.938754 8.969377
## 2 15.756159 25.816833
## 3 5.248106 36.318965
## 4 8.698726 43.292381
## 5 1.126050 48.204769
## 6 41.040408 69.287999
knitr::kable(head(df_gr))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | prop | ypos |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5538 | 9/16/13 | NA | Mexico | MX | Guerrero | 1252 | San Pablo Atzompa | 14.04274 | 17.2250 | -98.5000 | (17.225000000000001, -98.5) | Landslide | Landslide | Medium | Downpour | NA | 0 | america.aljazeera.com | http://america.aljazeera.com/articles/2013/11/19/after-landslide-poorestofthepoorleftoutinthecoldinmexico.html | 17.938754 | 8.969377 | |||
| 7479 | 10/3/15 | Night | NA | Mexico | MX | Guerrero | 1201 | Pochutla | 12.33417 | Unknown | 17.5586 | -98.9483 | (17.558599999999998, -98.948300000000003) | Landslide | Landslide | Medium | Tropical cyclone | Marty | 0 | 0 | Tiempo | http://www.tiempoenlinea.com.mx/index.php/oaxaca-2/52715-deslave-afecta-62-viviendas-en-la-montana-de-guerrero | 15.756159 | 25.816833 |
| 6269 | 10/18/14 | NA | Mexico | MX | Guerrero | 1018 | Colonia Alborada | 4.10830 | Above road | 16.8850 | -99.8562 | (16.885000000000002, -99.856200000000001) | Landslide | Landslide | Small | Tropical cyclone | Trudy | 0 | 0 | Thomson Reuters Foundation | http://www.trust.org/item/20141018173449-r3rca/ | 5.248106 | 36.318965 | |
| 3834 | 7/22/11 | NA | Mexico | MX | Guerrero | 165250 | Chilpancingo de los Bravos | 6.80950 | 17.4974 | -99.5380 | (17.497399999999999, -99.537999999999997) | Landslide | Landslide | Medium | Tropical cyclone | Hurricane Dora | NA | 0 | 8.698726 | 43.292381 | ||||
| 5543 | 9/16/13 | NA | Mexico | MX | Guerrero | 165250 | Chilpancingo de los Bravos | 0.88149 | 17.5482 | -99.5137 | (17.548200000000001, -99.5137) | Landslide | Mudslide | Medium | Tropical cyclone | Ingrid | NA | 4 | www.washingtonpost.com | http://www.washingtonpost.com/world/two-storms-batter-mexico-killing-dozens/2013/09/17/5cd3d81e-1f8e-11e3-b7d1-7153ad47b549_gallery.html#photo=6 | 1.126050 | 48.204769 | ||
| 5534 | 9/16/13 | 15:30 | NA | Mexico | MX | Guerrero | 21407 | Atoyac de Álvarez | 32.12708 | Deforested slope | 17.3461 | -100.1681 | (17.3461, -100.1681) | Landslide | Mudslide | Medium | Tropical cyclone | Manuel | 4 | 71 | Vice News | https://news.vice.com/article/a-mexican-town-mourns-its-missing-one-year-after-being-engulfed-by-mud | 41.040408 | 69.287999 |
stem(df_gr$"Distance")
##
## The decimal point is 1 digit(s) to the right of the |
##
## 0 | 11477
## 1 | 24
## 2 |
## 3 | 2
stem(df_gr$"Distance", scale = 2)
##
## The decimal point is 1 digit(s) to the right of the |
##
## 0 | 114
## 0 | 77
## 1 | 24
## 1 |
## 2 |
## 2 |
## 3 | 2
library(forecast)
data<- ts(df_gr$Distance, frequency=12, start=2008)
knitr::kable(head(data))
| x |
|---|
| 14.04274 |
| 12.33417 |
| 4.10830 |
| 6.80950 |
| 0.88149 |
| 32.12708 |
autoplot(data) + labs(title = "Gráfico de series temporales", x="date", y = "distancia", colour = "green") +theme_bw()
library(questionr)
table <- questionr::freq(Distance, cum = TRUE, sort = "dec", total = TRUE)
knitr::kable(table)
| n | % | val% | %cum | val%cum | |
|---|---|---|---|---|---|
| 0.88149 | 1 | 12.5 | 12.5 | 12.5 | 12.5 |
| 0.90692 | 1 | 12.5 | 12.5 | 25.0 | 25.0 |
| 4.1083 | 1 | 12.5 | 12.5 | 37.5 | 37.5 |
| 6.8095 | 1 | 12.5 | 12.5 | 50.0 | 50.0 |
| 7.07138 | 1 | 12.5 | 12.5 | 62.5 | 62.5 |
| 12.33417 | 1 | 12.5 | 12.5 | 75.0 | 75.0 |
| 14.04274 | 1 | 12.5 | 12.5 | 87.5 | 87.5 |
| 32.12708 | 1 | 12.5 | 12.5 | 100.0 | 100.0 |
| Total | 8 | 100.0 | 100.0 | 100.0 | 100.0 |
str(table)
## Classes 'freqtab' and 'data.frame': 9 obs. of 5 variables:
## $ n : num 1 1 1 1 1 1 1 1 8
## $ % : num 12.5 12.5 12.5 12.5 12.5 12.5 12.5 12.5 100
## $ val% : num 12.5 12.5 12.5 12.5 12.5 12.5 12.5 12.5 100
## $ %cum : num 12.5 25 37.5 50 62.5 75 87.5 100 100
## $ val%cum: num 12.5 25 37.5 50 62.5 75 87.5 100 100
x <- row.names(table)
y <- table$n
names <- x[1:(length(x)-1)]
freqs <- y[1:(length(y)-1)]
df_gr <- data.frame(x = names, y = freqs)
knitr::kable(df_gr)
| x | y |
|---|---|
| 0.88149 | 1 |
| 0.90692 | 1 |
| 4.1083 | 1 |
| 6.8095 | 1 |
| 7.07138 | 1 |
| 12.33417 | 1 |
| 14.04274 | 1 |
| 32.12708 | 1 |
library(ggplot2)
ggplot(data=df_gr, aes(x=x, y=y)) +
geom_bar(stat="identity", color="white", fill="blue") +
xlab("Rango de deslizamiento") +
ylab("Frecuencia")
n_sturges = 1 + log(length(Distance))/log(2)
n_sturgesc = ceiling(n_sturges)
n_sturgesf = floor(n_sturges)
n_clases = 0
if (n_sturgesc%%2 == 0) {
n_clases = n_sturgesf
} else {
n_clases = n_sturgesc
}
R = max(Distance) - min(Distance)
w = ceiling(R/n_clases)
bins <- seq(min(Distance), max(Distance) + w, by = w)
bins
## [1] 0.88149 8.88149 16.88149 24.88149 32.88149
Edades <- cut(Distance, bins)
Freq_table <- transform(table(Distance), Rel_Freq=prop.table(Freq), Cum_Freq=cumsum(Freq))
knitr::kable(Freq_table)
| Distance | Freq | Rel_Freq | Cum_Freq |
|---|---|---|---|
| 0.88149 | 1 | 0.125 | 1 |
| 0.90692 | 1 | 0.125 | 2 |
| 4.1083 | 1 | 0.125 | 3 |
| 6.8095 | 1 | 0.125 | 4 |
| 7.07138 | 1 | 0.125 | 5 |
| 12.33417 | 1 | 0.125 | 6 |
| 14.04274 | 1 | 0.125 | 7 |
| 32.12708 | 1 | 0.125 | 8 |
str(Freq_table)
## 'data.frame': 8 obs. of 4 variables:
## $ Distance: Factor w/ 8 levels "0.88149","0.90692",..: 1 2 3 4 5 6 7 8
## $ Freq : int 1 1 1 1 1 1 1 1
## $ Rel_Freq: num 0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125
## $ Cum_Freq: int 1 2 3 4 5 6 7 8
df_gr <- data.frame(x = Freq_table$Distance, y = Freq_table$Freq)
knitr::kable(df_gr)
| x | y |
|---|---|
| 0.88149 | 1 |
| 0.90692 | 1 |
| 4.1083 | 1 |
| 6.8095 | 1 |
| 7.07138 | 1 |
| 12.33417 | 1 |
| 14.04274 | 1 |
| 32.12708 | 1 |
library(ggplot2)
ggplot(data=df_gr, aes(x=x, y=y)) +
geom_bar(stat="identity", color="blue", fill="green") +
xlab("Rango de Distance") +
ylab("Frecuencia")
Estos se encargan de la toma de datos cuantitativa con respecto a la información proporcionada, los datos se calculan a partir de la media, mediana, moda, cuartiles etc.
summary(df_gr$Distance)
## Length Class Mode
## 0 NULL NULL
library(pastecs)
stat.desc(df_gr)
## x y
## nbr.val NA 8
## nbr.null NA 0
## nbr.na NA 0
## min NA 1
## max NA 1
## range NA 0
## sum NA 8
## median NA 1
## mean NA 1
## SE.mean NA 0
## CI.mean NA 0
## var NA 0
## std.dev NA 0
## coef.var NA 0
boxplot(Distance, horizontal=TRUE, col='steelblue')
library(readr)
library(knitr)
df_mx <- subset (df, Country == "Mexico")
knitr::kable(head(df_mx))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 13 | 115 | 7/4/07 | NA | Mexico | MX | Veracruz-Llave | 1947 | Laguna Chica (Pueblo Nuevo) | 9.51003 | 18.5369 | -96.8229 | (18.536899999999999, -96.822900000000004) | Landslide | Landslide | Medium | Rain | NA | 7 | nytimes.com | http://www.nytimes.com/2007/07/04/world/americas/04cnd-mexico.html?_r=1&hp&oref=slogin | |||
| 29 | 201 | 8/23/07 | NA | Mexico | MX | Puebla | 1414 | Xochitlaxco (San Baltazar) | 1.68294 | 19.9333 | -97.8500 | (19.933299999999999, -97.85) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Dean | NA | 6 | Inquirer.com | http://newsinfo.inquirer.net/breakingnews/world/view_article.php?article_id=84452 | ||
| 31 | 225 | 9/2/07 | NA | Mexico | MX | Sinaloa | 3191 | El Limón de los Ramos | 10.88351 | 24.9531 | -107.6220 | (24.953099999999999, -107.622) | Landslide | Complex | Medium | Tropical cyclone | Tropical Storm Henrietta | NA | 3 | ||||
| 42 | 284 | 9/28/07 | NA | Mexico | MX | Puebla | 3761 | Xaltepuxtla | 7.93258 | 20.2000 | -97.9000 | (20.2, -97.9) | Landslide | Mudslide | Medium | Tropical cyclone | Hurricane Lorenzo | NA | 1 | PressTV.ir | http://www.presstv.ir/detail.aspx?id=25037§ionid=3510207 | ||
| 57 | 342 | 10/31/07 | NA | Mexico | MX | Tabasco | 4468 | Buenavista | 4.19108 | 17.9493 | -92.5534 | (17.949300000000001, -92.553399999999996) | Landslide | Landslide | Medium | Rain | NA | 18 | CapeTimes | http://www.capetimes.co.za/?fArticleId=4109453 | |||
| 59 | 346 | 11/4/07 | NA | Mexico | MX | Chiapas | 3183 | Ostuacán | 3.74149 | 17.3900 | -93.3060 | (17.39, -93.305999999999997) | Landslide | Mudslide | Very_large | Rain | NA | 5 | Reuters - AlertNet.org | http://news.monstersandcritics.com/americas/news/article_1371436.php/Mudslide_is_latest_disaster_for_hard-hit_Mexico__2nd_Roundup_ |
library(readr)
library(knitr)
df_vrc <- subset (df, State == "Veracruz")
df_vrc %>%
select(Country, State, City, Distance)
## Country State City Distance
## 1376 Mexico Veracruz Chocaman 1.93516
## 1601 Mexico Veracruz Cruz Verde 2.47800
library(ggplot2)
ggplot(data=df_vrc, aes(x= State , y= Distance)) + geom_bar(stat="identity", color="black", fill="blue")
library(ggplot2)
library(dplyr)
ggplot(data=df_vrc, aes(fill=City, x="Veracruz", y=Distance)) +
geom_bar(position="dodge", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_vrc, aes(fill=City, x="Veracruz", y=Distance)) +
geom_bar(position="stack", stat="identity", color="black")
library(ggplot2)
library(dplyr)
ggplot(data=df_vrc, aes(x = "Veracruz", y = Distance , fill=City)) +
geom_bar(stat = "identity", width = 1) +
coord_polar("y", start = 0)
library(ggplot2)
library(dplyr)
df_vrc <- df_vrc %>%
arrange(desc(City)) %>%
mutate(prop = Distance / sum(df_vrc$Distance) *100) %>%
mutate(ypos = cumsum(prop)- 0.5*prop )
require(scales)
ggplot(df_vrc, aes(x= State, y = prop, fill=City)) +
geom_bar(stat="identity", width=1, color="black") +
coord_polar("y", start=0) +
theme_void() +
theme(legend.position="none") +
geom_text(aes(y = ypos, label = percent(prop/100)), color = "black", size=3) +
scale_fill_brewer(palette="Set4")
## Warning in pal_name(palette, type): Unknown palette Set4
library(qcc)
Distance <- df_vrc$Distance
names(Distance) <- df_vrc$City
pareto.chart(Distance,
ylab="Distance",
col = heat.colors(length(Distance)),
cumperc = seq(0, 100, by = 10),
ylab2 = "Porcentaje acumulado",
main = "DONDE SE CONCENTRAN LAS CIUDADES CON MAYORES DESLIZAMIENTOS")
##
## Pareto chart analysis for Distance
## Frequency Cum.Freq. Percentage Cum.Percent.
## Cruz Verde 2.47800 2.47800 56.15024 56.15024
## Chocaman 1.93516 4.41316 43.84976 100.00000
stem(df_vrc$"Distance")
##
## The decimal point is 1 digit(s) to the left of the |
##
## 18 | 4
## 20 |
## 22 |
## 24 | 8
head(df_vrc)
## id date time continent_code Country country_code State population
## 1 7445 9/17/15 <NA> Mexico MX Veracruz 1005
## 2 6688 1/5/14 Night <NA> Mexico MX Veracruz 9277
## City Distance location_description latitude longitude
## 1 Cruz Verde 2.47800 Deforested slope 19.1331 -97.1317
## 2 Chocaman 1.93516 Unknown 19.0294 -97.0355
## geolocation hazard_type landslide_type
## 1 (19.133099999999999, -97.131699999999995) Landslide Landslide
## 2 (19.029399999999999, -97.035499999999999) Landslide Landslide
## landslide_size trigger storm_name injuries fatalities source_name
## 1 Medium Rain 0 6 El Diario
## 2 Medium Rain 0 0 Calor
## source_link
## 1 http://www.eldiariony.com/2015/09/17/deslizamiento-de-cerro-en-veracruz-deja-seis-muertos/
## 2 http://www.alcalorpolitico.com/informacion/saldo-blanco-en-deslave-de-chocaman-familias-salieron-a-tiempo-maza-limon-139202.html#.VLfpVPnF98E
## prop ypos
## 1 56.15024 28.07512
## 2 43.84976 78.07512
knitr::kable(head(df_vrc))
| id | date | time | continent_code | Country | country_code | State | population | City | Distance | location_description | latitude | longitude | geolocation | hazard_type | landslide_type | landslide_size | trigger | storm_name | injuries | fatalities | source_name | source_link | prop | ypos |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 7445 | 9/17/15 | NA | Mexico | MX | Veracruz | 1005 | Cruz Verde | 2.47800 | Deforested slope | 19.1331 | -97.1317 | (19.133099999999999, -97.131699999999995) | Landslide | Landslide | Medium | Rain | 0 | 6 | El Diario | http://www.eldiariony.com/2015/09/17/deslizamiento-de-cerro-en-veracruz-deja-seis-muertos/ | 56.15024 | 28.07512 | ||
| 6688 | 1/5/14 | Night | NA | Mexico | MX | Veracruz | 9277 | Chocaman | 1.93516 | Unknown | 19.0294 | -97.0355 | (19.029399999999999, -97.035499999999999) | Landslide | Landslide | Medium | Rain | 0 | 0 | Calor | http://www.alcalorpolitico.com/informacion/saldo-blanco-en-deslave-de-chocaman-familias-salieron-a-tiempo-maza-limon-139202.html#.VLfpVPnF98E | 43.84976 | 78.07512 |
stem(df_vrc$"Distance")
##
## The decimal point is 1 digit(s) to the left of the |
##
## 18 | 4
## 20 |
## 22 |
## 24 | 8
stem(df_vrc$"Distance", scale = 2)
##
## The decimal point is 1 digit(s) to the left of the |
##
## 19 | 4
## 20 |
## 21 |
## 22 |
## 23 |
## 24 | 8
library(forecast)
data<- ts(df_vrc$Distance, frequency=12, start=2008)
knitr::kable(head(data))
| x |
|---|
| 2.47800 |
| 1.93516 |
autoplot(data) + labs(title = "Gráfico de series temporales", x="date", y = "distancia", colour = "green") +theme_bw()
library(questionr)
table <- questionr::freq(Distance, cum = TRUE, sort = "dec", total = TRUE)
knitr::kable(table)
| n | % | val% | %cum | val%cum | |
|---|---|---|---|---|---|
| 1.93516 | 1 | 50 | 50 | 50 | 50 |
| 2.478 | 1 | 50 | 50 | 100 | 100 |
| Total | 2 | 100 | 100 | 100 | 100 |
str(table)
## Classes 'freqtab' and 'data.frame': 3 obs. of 5 variables:
## $ n : num 1 1 2
## $ % : num 50 50 100
## $ val% : num 50 50 100
## $ %cum : num 50 100 100
## $ val%cum: num 50 100 100
x <- row.names(table)
y <- table$n
names <- x[1:(length(x)-1)]
freqs <- y[1:(length(y)-1)]
df_vrc <- data.frame(x = names, y = freqs)
knitr::kable(df_vrc)
| x | y |
|---|---|
| 1.93516 | 1 |
| 2.478 | 1 |
library(ggplot2)
ggplot(data=df_vrc, aes(x=x, y=y)) +
geom_bar(stat="identity", color="white", fill="blue") +
xlab("Rango de deslizamiento") +
ylab("Frecuencia")
n_sturges = 1 + log(length(Distance))/log(2)
n_sturgesc = ceiling(n_sturges)
n_sturgesf = floor(n_sturges)
n_clases = 0
if (n_sturgesc%%2 == 0) {
n_clases = n_sturgesf
} else {
n_clases = n_sturgesc
}
R = max(Distance) - min(Distance)
w = ceiling(R/n_clases)
bins <- seq(min(Distance), max(Distance) + w, by = w)
bins
## [1] 1.93516 2.93516
Edades <- cut(Distance, bins)
Freq_table <- transform(table(Distance), Rel_Freq=prop.table(Freq), Cum_Freq=cumsum(Freq))
knitr::kable(Freq_table)
| Distance | Freq | Rel_Freq | Cum_Freq |
|---|---|---|---|
| 1.93516 | 1 | 0.5 | 1 |
| 2.478 | 1 | 0.5 | 2 |
str(Freq_table)
## 'data.frame': 2 obs. of 4 variables:
## $ Distance: Factor w/ 2 levels "1.93516","2.478": 1 2
## $ Freq : int 1 1
## $ Rel_Freq: num 0.5 0.5
## $ Cum_Freq: int 1 2
df_vrc <- data.frame(x = Freq_table$Distance, y = Freq_table$Freq)
knitr::kable(df_vrc)
| x | y |
|---|---|
| 1.93516 | 1 |
| 2.478 | 1 |
library(ggplot2)
ggplot(data=df_vrc, aes(x=x, y=y)) +
geom_bar(stat="identity", color="blue", fill="green") +
xlab("Rango de Distance") +
ylab("Frecuencia")
Estos se encargan de la toma de datos cuantitativa con respecto a la información proporcionada, los datos se calculan a partir de la media, mediana, moda, cuartiles etc.
summary(df_vrc$Distance)
## Length Class Mode
## 0 NULL NULL
library(pastecs)
stat.desc(df_vrc)
## x y
## nbr.val NA 2
## nbr.null NA 0
## nbr.na NA 0
## min NA 1
## max NA 1
## range NA 0
## sum NA 2
## median NA 1
## mean NA 1
## SE.mean NA 0
## CI.mean NA 0
## var NA 0
## std.dev NA 0
## coef.var NA 0
boxplot(Distance, horizontal=TRUE, col='steelblue')
En conclusión, después de analizar y trabajar todos los métodos para generar los gráficos a partir de la información de la delimitación del área de estudio ( Centroamérica), podemos observar que el país con más datos de deslizamientos es méxico, sin embargo guatemala es uno de los más prioritarios, esto basado al diagrama de pareto en el que de izquierda a derecha este obtuvo mayor valor de primordialidad, lo que quiere decir que los deslizamientos son de mayor magnitud y pueden ser más peligrosos.