2014年10月03日:過去30日間に発生した地震に関する各種ヒストグラム-世界全体および日本の状況について


Execution

Sys.time()
## [1] "2014-10-03 13:37:10 JST"

Package

library(xts) # http://cran.r-project.org/web/packages/xts/xts.pdf
library(ggplot2) # http://cran.r-project.org/web/packages/ggplot2/ggplot2.pdf
library(gridExtra) #http://cran.r-project.org/web/packages/gridExtra/gridExtra.pdf
library(knitr) # http://cran.r-project.org/web/packages/knitr/knitr.pdf
library(googleVis) # http://cran.r-project.org/web/packages/googleVis/googleVis.pdf
library(xtable)
library(MASS)

Import Raw Data

data.location=2 #1:local 2:web
data.file="all_month.csv"
if(data.location==1){
username<-Sys.info()['user']
path01<-paste("C:/Users/",username,"/Desktop/Earthquake_Data/",sep="")
setwd(path01)
dataset<-read.table(file=paste(path01,data.file,sep=""),sep=",",header=T,as.is=T,skip=0)
}else{
dataset<-read.csv(paste("http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/",data.file,sep=""),header=T,as.is=T,skip=0) 
}
dataset.j<-dataset[grep("Japan",dataset[,14]),]

Part of Raw Data

head(dataset,1)
##                       time latitude longitude depth  mag magType nst gap
## 1 2014-10-03T04:07:52.200Z    35.86    -118.1 12.87 1.67      ml  12 114
##      dmin rms net         id                  updated
## 1 0.02633 0.1  ci ci37047087 2014-10-03T04:10:35.870Z
##                           place       type
## 1 27km NE of Weldon, California earthquake
tail(dataset,1)
##                          time latitude longitude depth mag magType nst
## 8904 2014-09-03T04:19:23.700Z     38.8    -122.8   0.8   1      Md  13
##       gap     dmin  rms net         id                  updated
## 8904 75.6 0.008983 0.05  nc nc72290546 2014-09-03T04:51:08.764Z
##                                  place       type
## 8904 3km NW of The Geysers, California earthquake

Map for Earthquakes over magnitude 5.0 in the past 30 days

dataset$latlong<-paste(dataset$latitude,dataset$longitude,sep=":")
dataset$jst<-as.POSIXct(sub("Z","",sub("T"," ",dataset$time)))+3600*9
dataset$info<-paste("Time(UTC)=",dataset$time," , UTC+9=",dataset$jst,", Depth(km)=",dataset$depth,", Mag=",dataset$mag," , MagType=",dataset$magType,", Place=",dataset$place,sep="")
dataset.s<-subset(dataset,5<=dataset[,5])
gMap<-gvisMap(
dataset.s,"latlong","info",
options=list(
showTip=TRUE, 
showLine=TRUE, 
enableScrollWheel=TRUE,
mapType='terrain', #'hybrid','normal','terrain','satellite'
useMapTypeControl=TRUE
)
)
print(gMap,tag="chart")




Number of Earthquakes in the past 30days by Magnitude

  • Ratio(%)=Japan/World*100
region<-c("","Japan","Indonesia","Mexico","Alaska")
mgt<-c(-10^2,1,2.5,4.5,5.5)
Ecount<-matrix(nrow=length(mgt),ncol=length(region))
for(rrr in 1:length(region)){
r.dataset<-dataset[grep(region[rrr],dataset[,14]),]
for(mmm in 1:length(mgt)){
count<-length(subset(r.dataset,mgt[mmm]<=r.dataset[,5])[,1])
Ecount[mmm,rrr]<-count
}
}
Ecount<-as.data.frame(Ecount,stringsAsFactors=F)
rownames(Ecount)<-paste("over",mgt,sep="")
rownames(Ecount)[1]<-"All"
colnames(Ecount)<-region
colnames(Ecount)[1]<-"World"
Ratio<-signif(Ecount$Japan/Ecount$World*100,digits=2)
Ecount<-cbind(Ecount,Ratio)
Ecount<-Ecount[,c(1,2,6,3,4,5)]
print(xtable(Ecount),type="html")


World Japan Ratio Indonesia Mexico Alaska
All 8904 39 0.44 58 52 2418
over1 5680 39 0.69 58 52 1895
over2.5 1253 39 3.10 58 31 207
over4.5 394 31 7.90 45 13 8
over5.5 25 1 4.00 5 1 1

Histogram

bw=c(5,5,10,0.1)
for(rrr in 1:length(region)){
r.dataset<-dataset[grep(region[rrr],dataset[,14]),]
if(rrr==1){PlotTitle<-"World"}else{PlotTitle<-region[rrr]}
for(ppp in 1:4){ 
switch(ppp,
g<-ggplot(r.dataset,aes(x=latitude)),
g<-ggplot(r.dataset,aes(x=longitude)),
g<-ggplot(r.dataset,aes(x=depth)),
g<-ggplot(r.dataset,aes(x=mag))
)  
g<-g+geom_histogram(alpha=0.2,binwidth=bw[ppp],colour="blue")
g<-g+labs(title=PlotTitle)
g<-g+theme(plot.title=element_text(size=9))
g<-g+theme(axis.title.x=element_text(size=9),axis.title.y=element_text(size=9)) 
g<-g+theme(axis.text.x=element_text(size=9),axis.text.y=element_text(size=9)) 
switch(ppp,
lat<-g,
lon<-g,
dep<-g,
magn<-g
)
}
grid.arrange(lat,lon,dep,magn,nrow=1,ncol=4)
}

plot of chunk unnamed-chunk-7plot of chunk unnamed-chunk-7plot of chunk unnamed-chunk-7plot of chunk unnamed-chunk-7plot of chunk unnamed-chunk-7

Latest Earthquake

print(dataset[,18][1])
## [1] "Time(UTC)=2014-10-03T04:07:52.200Z , UTC+9=2014-10-03 13:07:52, Depth(km)=12.87, Mag=1.67 , MagType=ml, Place=27km NE of Weldon, California"

Maximum Magnitude Earth Quake in the past 30 days

row.id<-which(max(dataset[,5])==dataset[,5])
print(dataset[,18][row.id])
## [1] "Time(UTC)=2014-09-17T06:14:46.200Z , UTC+9=2014-09-17 15:14:46, Depth(km)=136.7, Mag=6.7 , MagType=mwc, Place=45km NW of Piti Village, Guam"

Earthquake List Over Mag5.0

Elist<-dataset.s[,c(17,5,6,14)]
kable(Elist)
## 
## 
## |     |jst                 | mag|magType |place                                                      |
## |:----|:-------------------|---:|:-------|:----------------------------------------------------------|
## |24   |2014-10-03 09:57:30 | 5.3|mb      |89km NE of Miyako, Japan                                   |
## |95   |2014-10-03 00:56:32 | 5.4|mb      |114km SSE of Delingha Shi, China                           |
## |114  |2014-10-02 21:57:06 | 5.7|mb      |65km SSW of Paratunka, Russia                              |
## |172  |2014-10-02 16:02:05 | 5.0|mb      |77km NE of `Ohonua, Tonga                                  |
## |228  |2014-10-02 09:13:39 | 5.0|mb      |57km ENE of `Ohonua, Tonga                                 |
## |273  |2014-10-02 04:20:11 | 5.1|mb      |Northern Mid-Atlantic Ridge                                |
## |428  |2014-10-01 12:38:54 | 5.7|mb      |20km NNW of Kandrian, Papua New Guinea                     |
## |453  |2014-10-01 10:23:30 | 5.1|mb      |42km SE of Yuecheng, China                                 |
## |478  |2014-10-01 07:34:27 | 5.5|mwp     |264km SE of Lambasa, Fiji                                  |
## |510  |2014-10-01 04:23:54 | 5.2|mb      |34km N of Taron, Papua New Guinea                          |
## |533  |2014-10-01 01:45:56 | 5.5|mwb     |Carlsberg Ridge                                            |
## |554  |2014-09-30 22:46:26 | 5.2|mb      |53km NNW of Finschhafen, Papua New Guinea                  |
## |760  |2014-09-29 22:43:01 | 5.3|mb      |101km WNW of Hofn, Iceland                                 |
## |877  |2014-09-29 10:38:12 | 5.3|mb      |22km ESE of Kurush, Russia                                 |
## |1046 |2014-09-28 17:46:32 | 5.2|mb      |81km WSW of Constitucion, Chile                            |
## |1085 |2014-09-28 15:23:34 | 5.2|mb      |245km WNW of Pangai, Tonga                                 |
## |1158 |2014-09-28 07:49:04 | 5.2|mb      |14km S of Farkhar, Afghanistan                             |
## |1230 |2014-09-27 23:39:23 | 5.1|mb      |100km S of Kotaagung, Indonesia                            |
## |1499 |2014-09-27 05:34:16 | 5.3|mb      |28km NW of Lae, Papua New Guinea                           |
## |1555 |2014-09-27 03:29:10 | 5.1|mb      |220km SE of Sarangani, Philippines                         |
## |1639 |2014-09-27 01:16:03 | 5.0|mb      |6km S of Gigmoto, Philippines                              |
## |2253 |2014-09-26 13:21:24 | 5.4|mb      |285km ENE of Port Blair, India                             |
## |2276 |2014-09-26 12:55:34 | 5.3|mb      |41km NW of Lae, Papua New Guinea                           |
## |2530 |2014-09-26 03:59:58 | 5.1|mb      |79km NNW of Visokoi Island,                                |
## |2540 |2014-09-26 02:51:17 | 6.2|ml      |94km WNW of Willow, Alaska                                 |
## |2688 |2014-09-25 19:35:02 | 5.0|mb      |20km ENE of Taitung City, Taiwan                           |
## |2701 |2014-09-25 18:13:50 | 6.0|mb      |160km SSW of Gizo, Solomon Islands                         |
## |2729 |2014-09-25 15:16:12 | 5.1|mb      |100km NNE of Awaran, Pakistan                              |
## |2758 |2014-09-25 11:31:58 | 5.5|mwb     |92km WSW of Khuzdar, Pakistan                              |
## |2870 |2014-09-24 22:30:57 | 5.1|mww     |30km ENE of Namie, Japan                                   |
## |2874 |2014-09-24 21:45:46 | 5.0|mb      |41km E of Namie, Japan                                     |
## |2889 |2014-09-24 20:16:12 | 6.2|mwp     |46km NNW of San Antonio de los Cobres, Argentina           |
## |2943 |2014-09-24 15:34:36 | 5.1|mb      |144km NW of Constitucion, Chile                            |
## |2966 |2014-09-24 13:43:26 | 5.0|mb      |192km S of Puerto El Triunfo, El Salvador                  |
## |3061 |2014-09-24 04:18:25 | 5.4|mww     |Reykjanes Ridge                                            |
## |3157 |2014-09-24 00:24:01 | 5.4|mb      |128km SSW of Kokopo, Papua New Guinea                      |
## |3210 |2014-09-23 19:22:19 | 5.3|mb      |90km SW of Tinabogan, Indonesia                            |
## |3264 |2014-09-23 13:34:00 | 5.1|mb      |111km WNW of Hofn, Iceland                                 |
## |3371 |2014-09-23 03:35:46 | 5.1|mb      |West Chile Rise                                            |
## |3405 |2014-09-23 01:15:54 | 5.0|mb      |65km SSE of Pangai, Tonga                                  |
## |3407 |2014-09-23 01:01:42 | 5.7|mwb     |85km NNW of Visokoi Island,                                |
## |3421 |2014-09-22 23:41:22 | 5.4|mb      |37km SE of Palmerston North, New Zealand                   |
## |3602 |2014-09-22 02:32:04 | 5.2|mb      |270km WNW of Chichi-shima, Japan                           |
## |3616 |2014-09-22 00:45:20 | 5.2|mb      |Easter Island region                                       |
## |3622 |2014-09-22 00:05:27 | 5.2|mb      |252km NNE of Whakatane, New Zealand                        |
## |3624 |2014-09-22 00:02:30 | 5.3|mb      |227km ENE of Tairua, New Zealand                           |
## |3668 |2014-09-21 19:51:48 | 5.1|mb      |107km WNW of Hofn, Iceland                                 |
## |3770 |2014-09-21 09:43:43 | 5.2|mb      |2km WSW of Nafpaktos, Greece                               |
## |3833 |2014-09-21 03:27:13 | 5.5|mb      |26km ENE of Manokwari, Indonesia                           |
## |4003 |2014-09-20 14:12:17 | 5.0|mb      |62km SSW of Ocos, Guatemala                                |
## |4011 |2014-09-20 13:26:10 | 5.2|mb      |10km ESE of Bulatukan, Philippines                         |
## |4034 |2014-09-20 12:03:53 | 5.2|mb      |108km SW of Mapastepec, Mexico                             |
## |4053 |2014-09-20 10:10:14 | 5.0|mb      |99km WNW of Hofn, Iceland                                  |
## |4169 |2014-09-19 21:55:51 | 5.3|mb      |62km SSE of Kirakira, Solomon Islands                      |
## |4257 |2014-09-19 11:57:35 | 5.1|mb      |147km ESE of Sarangani, Philippines                        |
## |4363 |2014-09-18 23:21:49 | 5.0|mb      |102km NW of Hofn, Iceland                                  |
## |4372 |2014-09-18 22:14:16 | 5.1|mb      |65km WNW of Sardinal, Costa Rica                           |
## |4446 |2014-09-18 13:17:53 | 5.4|mb      |204km NNE of Vostok, Russia                                |
## |4483 |2014-09-18 08:18:55 | 5.4|mb      |11km ENE of Hirara, Japan                                  |
## |4618 |2014-09-17 19:36:48 | 5.0|mb      |78km SE of Lukatan, Philippines                            |
## |4674 |2014-09-17 15:14:46 | 6.7|mwc     |45km NW of Piti Village, Guam                              |
## |4676 |2014-09-17 15:11:49 | 5.6|mb      |59km E of Lakatoro, Vanuatu                                |
## |4713 |2014-09-17 11:29:50 | 5.0|mb      |101km SSE of Bengkulu, Indonesia                           |
## |4766 |2014-09-17 06:34:15 | 5.1|mb      |108km WNW of Hofn, Iceland                                 |
## |4804 |2014-09-17 03:39:46 | 5.2|mb      |69km WSW of Kuril'sk, Russia                               |
## |4823 |2014-09-17 01:49:35 | 5.1|mb      |73km SE of Punta de Burica, Panama                         |
## |4874 |2014-09-16 22:00:20 | 5.3|mb      |190km SSW of Ndoi Island, Fiji                             |
## |4999 |2014-09-16 12:28:31 | 5.6|mb      |2km WNW of Iwai, Japan                                     |
## |5010 |2014-09-16 11:35:19 | 5.6|mb      |189km ESE of Kimbe, Papua New Guinea                       |
## |5025 |2014-09-16 10:08:19 | 5.2|mb      |38km SW of Ndoi Island, Fiji                               |
## |5065 |2014-09-16 06:09:08 | 5.4|mb      |81km E of Le Vauclin, Martinique                           |
## |5192 |2014-09-15 18:43:25 | 5.0|mb      |143km S of Sarangani, Philippines                          |
## |5208 |2014-09-15 17:05:02 | 5.3|mb      |108km WNW of Hofn, Iceland                                 |
## |5363 |2014-09-15 03:17:44 | 5.0|mb      |55km ENE of `Ohonua, Tonga                                 |
## |5380 |2014-09-15 01:34:22 | 5.1|mb      |176km SSE of Sinabang, Indonesia                           |
## |5505 |2014-09-14 13:52:26 | 5.3|mb      |179km SSE of Sinabang, Indonesia                           |
## |5577 |2014-09-14 07:31:59 | 5.3|mb      |8km WSW of `Alaqahdari-ye Kiran wa Munjan, Afghanistan     |
## |5618 |2014-09-14 03:22:14 | 5.4|mb      |125km NE of Neiafu, Tonga                                  |
## |5728 |2014-09-13 16:58:17 | 5.0|mb      |116km S of Akureyri, Iceland                               |
## |5901 |2014-09-13 00:41:48 | 5.1|mb      |72km NE of Amahai, Indonesia                               |
## |5920 |2014-09-12 22:06:33 | 5.0|mb      |106km NW of Mohean, India                                  |
## |5971 |2014-09-12 18:25:57 | 5.3|mb      |100km W of Sabang, Indonesia                               |
## |5986 |2014-09-12 16:56:54 | 5.0|mb      |180km WNW of Abepura, Indonesia                            |
## |5989 |2014-09-12 16:47:27 | 5.3|mb      |209km NNW of Farallon de Pajaros, Northern Mariana Islands |
## |6027 |2014-09-12 13:04:08 | 5.0|mb      |61km SSW of Sola, Vanuatu                                  |
## |6040 |2014-09-12 12:19:31 | 5.1|mb      |300km NE of Palmer Station, Antarctica                     |
## |6053 |2014-09-12 11:22:57 | 5.0|mb      |82km SSE of Panguna, Papua New Guinea                      |
## |6138 |2014-09-12 04:57:16 | 5.1|mb      |113km SSE of Akureyri, Iceland                             |
## |6169 |2014-09-12 01:58:12 | 5.1|mb      |70km E of Luganville, Vanuatu                              |
## |6357 |2014-09-11 09:07:41 | 5.1|mb      |97km WNW of Hofn, Iceland                                  |
## |6424 |2014-09-11 03:27:59 | 5.3|mb      |23km NW of Little Sitkin Island, Alaska                    |
## |6452 |2014-09-11 01:31:59 | 5.3|mb      |South of the Fiji Islands                                  |
## |6492 |2014-09-10 23:01:01 | 5.0|mb      |131km E of Tadine, New Caledonia                           |
## |6548 |2014-09-10 18:32:59 | 5.6|mb      |141km SE of Lolayan, Indonesia                             |
## |6574 |2014-09-10 16:30:52 | 5.0|mb      |144km SE of Modayag, Indonesia                             |
## |6595 |2014-09-10 14:59:47 | 5.0|mb      |146km SE of Modayag, Indonesia                             |
## |6602 |2014-09-10 14:19:25 | 5.6|mb      |126km SE of Modayag, Indonesia                             |
## |6605 |2014-09-10 14:16:53 | 5.7|mb      |129km SE of Lolayan, Indonesia                             |
## |6630 |2014-09-10 11:46:06 | 6.2|mww     |132km SE of Modayag, Indonesia                             |
## |6655 |2014-09-10 10:09:37 | 5.1|mb      |49km E of Ichinohe, Japan                                  |
## |6745 |2014-09-10 03:15:00 | 5.0|mb      |Western Indian-Antarctic Ridge                             |
## |6856 |2014-09-09 18:28:23 | 5.4|mb      |40km SSE of Saiha, India                                   |
## |6965 |2014-09-09 10:07:29 | 5.2|mww     |113km WNW of Hofn, Iceland                                 |
## |6977 |2014-09-09 09:26:24 | 5.1|mb      |43km S of Manubul, Philippines                             |
## |7071 |2014-09-09 02:53:17 | 5.3|mb      |104km E of Madang, Papua New Guinea                        |
## |7447 |2014-09-08 00:55:50 | 5.2|mb      |283km SE of Pondaguitan, Philippines                       |
## |7505 |2014-09-07 20:46:21 | 5.1|mb      |Federated States of Micronesia region                      |
## |7579 |2014-09-07 16:07:59 | 5.2|mb      |117km WNW of Hofn, Iceland                                 |
## |7607 |2014-09-07 14:23:48 | 5.0|mb      |100km WNW of Rabaul, Papua New Guinea                      |
## |7716 |2014-09-07 04:52:57 | 5.3|mb      |Easter Island region                                       |
## |7720 |2014-09-07 04:23:00 | 5.9|mwb     |222km WSW of Tomatlan, Mexico                              |
## |7826 |2014-09-06 17:37:46 | 5.1|mb      |Easter Island region                                       |
## |7835 |2014-09-06 16:48:34 | 5.4|mb      |Easter Island region                                       |
## |7859 |2014-09-06 16:04:07 | 5.2|mb      |Easter Island region                                       |
## |7863 |2014-09-06 15:53:13 | 6.1|mb      |Easter Island region                                       |
## |7884 |2014-09-06 15:03:52 | 5.1|mb      |169km NNW of Visokoi Island,                               |
## |7961 |2014-09-06 09:37:00 | 5.0|mb      |48km NW of Citeureup, Indonesia                            |
## |8004 |2014-09-06 06:24:38 | 5.3|mb      |Easter Island region                                       |
## |8026 |2014-09-06 04:36:32 | 5.8|mww     |Easter Island region                                       |
## |8144 |2014-09-05 18:19:24 | 5.1|mb      |Easter Island region                                       |
## |8168 |2014-09-05 16:21:49 | 5.1|mb      |119km N of Hirara, Japan                                   |
## |8246 |2014-09-05 10:19:38 | 5.2|mb      |104km WNW of Hofn, Iceland                                 |
## |8319 |2014-09-05 06:00:04 | 5.3|mww     |41km SE of Tekirova, Turkey                                |
## |8367 |2014-09-05 02:43:40 | 5.0|mwr     |36km NW of Myrina, Greece                                  |
## |8372 |2014-09-05 02:23:15 | 5.4|mwc     |Easter Island region                                       |
## |8491 |2014-09-04 18:26:53 | 5.1|mb      |57km SSW of Iquique, Chile                                 |
## |8548 |2014-09-04 14:33:46 | 6.0|mwb     |175km E of `Ohonua, Tonga                                  |
## |8625 |2014-09-04 08:34:14 | 5.2|mb      |43km S of George Town, Cayman Islands                      |
## |8661 |2014-09-04 05:33:59 | 5.9|mww     |Easter Island region                                       |
## |8662 |2014-09-04 05:28:22 | 5.2|mb      |Easter Island region                                       |
## |8736 |2014-09-04 00:14:52 | 5.2|mb      |53km SSE of Kirakira, Solomon Islands                      |
## |8759 |2014-09-03 22:43:58 | 5.3|mb      |37km ENE of Carlagan, Philippines                          |
## |8790 |2014-09-03 20:34:40 | 5.7|mww     |138km SSW of Gataivai, Samoa                               |
## |8820 |2014-09-03 19:01:04 | 5.1|mb      |35km S of George Town, Cayman Islands                      |
## |8858 |2014-09-03 16:43:31 | 5.7|mb      |107km NNE of Hihifo, Tonga                                 |
## |8859 |2014-09-03 16:24:20 | 5.2|mb      |21km NW of Nikko, Japan                                    |

Covariate Plot

attach(dataset)
coplot(latitude~longitude|mag)

plot of chunk unnamed-chunk-11

nrow(dataset)
## [1] 8904

Data Source/Reference