https://earthquake.usgs.gov/earthquakes/feed/v1.0/csv.php
Califoria only
magtitute classification : Low, Middle, Moderate, High
# Load and Explore Dataset
url <- "http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv"
library(data.table)
##
## Attaching package: 'data.table'
## The following objects are masked from 'package:lubridate':
##
## hour, isoweek, mday, minute, month, quarter, second, wday, week,
## yday, year
## The following objects are masked from 'package:dplyr':
##
## between, first, last
## The following object is masked from 'package:purrr':
##
## transpose
all <- fread(url,header=TRUE)
dim(all)
## [1] 10451 22
sum(complete.cases(all))
## [1] 5861
str(all)
## Classes 'data.table' and 'data.frame': 10451 obs. of 22 variables:
## $ time : chr "2019-12-25T20:45:58.900Z" "2019-12-25T20:40:15.880Z" "2019-12-25T20:38:52.929Z" "2019-12-25T20:31:05.220Z" ...
## $ latitude : num 37.3 47.2 50.9 33.6 38.8 ...
## $ longitude : num -118 -123 -130 -117 -123 ...
## $ depth : num 5.9 2.2 10 3.84 1.19 ...
## $ mag : num 1.6 2.65 4.8 0.58 0.89 ...
## $ magType : chr "ml" "md" "mwr" "ml" ...
## $ nst : int 12 17 NA 19 7 21 32 15 8 NA ...
## $ gap : num 124 284 167 82 225 ...
## $ dmin : num 0.08 NA 1.547 0.036 0.0167 ...
## $ rms : num 0.04 0.29 1.21 0.18 0.03 ...
## $ net : chr "nn" "uw" "us" "ci" ...
## $ id : chr "nn00713985" "uw61565187" "us70006r1m" "ci39013327" ...
## $ updated : chr "2019-12-25T20:49:12.489Z" "2019-12-25T20:43:18.920Z" "2019-12-25T20:58:14.040Z" "2019-12-25T20:34:50.401Z" ...
## $ place : chr "55km SSW of Goldfield, Nevada" "15km W of Shelton, Washington" "203km W of Port Hardy, Canada" "13km WNW of Anza, CA" ...
## $ type : chr "earthquake" "earthquake" "earthquake" "earthquake" ...
## $ horizontalError: num NA 8.34 9 0.36 0.91 0.37 0.24 0.39 NA 15.3 ...
## $ depthError : num 4.5 23.07 1.9 0.77 0.76 ...
## $ magError : num NA 0.32 0.083 0.202 0.21 ...
## $ magNst : int NA 3 14 10 2 6 12 5 NA 15 ...
## $ status : chr "automatic" "automatic" "reviewed" "automatic" ...
## $ locationSource : chr "nn" "uw" "us" "ci" ...
## $ magSource : chr "nn" "uw" "us" "ci" ...
## - attr(*, ".internal.selfref")=<externalptr>
## feature num_missing pct_missing
## 1: time 0 0.0000000000
## 2: latitude 0 0.0000000000
## 3: longitude 0 0.0000000000
## 4: depth 0 0.0000000000
## 5: mag 0 0.0000000000
## 6: magType 0 0.0000000000
## 7: nst 3483 0.3332695436
## 8: gap 2607 0.2494498134
## 9: dmin 2821 0.2699263228
## 10: rms 0 0.0000000000
## 11: net 0 0.0000000000
## 12: id 0 0.0000000000
## 13: updated 0 0.0000000000
## 14: place 0 0.0000000000
## 15: type 0 0.0000000000
## 16: horizontalError 3345 0.3200650655
## 17: depthError 2 0.0001913692
## 18: magError 2815 0.2693522151
## 19: magNst 2657 0.2542340446
## 20: status 0 0.0000000000
## 21: locationSource 0 0.0000000000
## 22: magSource 0 0.0000000000
## feature num_missing pct_missing
horizontalError: uncertainty of reported location of the event in kilometers
nst: total number of seismic stations used to determine earthquake location
dmin: horizontal distance from the epicenter to the nearest station (in degrees)
magError: uncertainty of reported magnitude of the event
magNst: total number of seismic stations used to calculate the magnitude for this earthquake
gap: largest azimuthal gap between azimuthally adjacent stations (in degrees)
rms: root-mean-square (RMS) travel time residual, in sec, using all weights
mag: magnitude for the event. Range [-1.0, 10.0]
missing data to be be removed : rms & mag. These value are independent and critical values
the rest will be imputed, sinces they are mostly different method of recording activities
## time latitude longitude depth mag magType nst gap
## 1 2019-11-29T00:49:42.870Z 35.71350 -117.5687 8.26 3.72 mw 43 58
## 2 2019-11-28T23:10:59.710Z 34.87517 -117.3905 2.40 3.50 mw 79 45
## 3 2019-11-28T06:00:17.300Z 36.09767 -117.8610 2.51 3.05 ml 38 54
## 4 2019-11-27T09:59:00.010Z 39.75000 -121.8437 22.25 3.02 ml 34 76
## 5 2019-11-26T00:06:03.190Z 35.56633 -117.3527 2.67 3.59 mw 69 27
## dmin rms net id updated
## 1 0.09126 0.15 ci ci39210096 2019-12-17T06:06:40.040Z
## 2 0.14770 0.17 ci ci39210040 2019-12-17T06:01:38.040Z
## 3 0.02048 0.14 ci ci39209360 2019-12-02T17:44:34.323Z
## 4 0.20210 0.17 nc nc73309356 2019-12-03T11:18:22.311Z
## 5 0.04241 0.21 ci ci39206448 2019-12-07T05:14:35.040Z
## place type horizontalError depthError magError
## 1 14km NE of Ridgecrest, CA earthquake 0.13 0.38 NA
## 2 27km ESE of Boron, CA earthquake 0.11 0.49 NA
## 3 10km NE of Coso Junction, CA earthquake 0.14 0.25 0.142
## 4 1km NNW of Chico, CA earthquake 0.32 0.58 0.165
## 5 22km S of Trona, CA earthquake 0.17 0.26 NA
## magNst status locationSource magSource date year month day
## 1 6 reviewed ci ci 2019-11-29 00:49:42 2019 11 29
## 2 4 reviewed ci ci 2019-11-28 23:10:59 2019 11 28
## 3 115 reviewed ci ci 2019-11-28 06:00:17 2019 11 28
## 4 17 reviewed nc nc 2019-11-27 09:59:00 2019 11 27
## 5 4 reviewed ci ci 2019-11-26 00:06:03 2019 11 26
## class
## 1 Third
## 2 Third
## 3 Third
## 4 Third
## 5 Third
## time latitude longitude depth
## Length:5 Min. :34.88 Min. :-121.8 Min. : 2.400
## Class :character 1st Qu.:35.57 1st Qu.:-117.9 1st Qu.: 2.510
## Mode :character Median :35.71 Median :-117.6 Median : 2.670
## Mean :36.40 Mean :-118.4 Mean : 7.618
## 3rd Qu.:36.10 3rd Qu.:-117.4 3rd Qu.: 8.260
## Max. :39.75 Max. :-117.4 Max. :22.250
##
## mag magType nst gap
## Min. :3.020 Length:5 Min. :34.0 Min. :27
## 1st Qu.:3.050 Class :character 1st Qu.:38.0 1st Qu.:45
## Median :3.500 Mode :character Median :43.0 Median :54
## Mean :3.376 Mean :52.6 Mean :52
## 3rd Qu.:3.590 3rd Qu.:69.0 3rd Qu.:58
## Max. :3.720 Max. :79.0 Max. :76
##
## dmin rms net id
## Min. :0.02048 Min. :0.140 Length:5 Length:5
## 1st Qu.:0.04241 1st Qu.:0.150 Class :character Class :character
## Median :0.09126 Median :0.170 Mode :character Mode :character
## Mean :0.10079 Mean :0.168
## 3rd Qu.:0.14770 3rd Qu.:0.170
## Max. :0.20210 Max. :0.210
##
## updated place type horizontalError
## Length:5 Length:5 Length:5 Min. :0.110
## Class :character Class :character Class :character 1st Qu.:0.130
## Mode :character Mode :character Mode :character Median :0.140
## Mean :0.174
## 3rd Qu.:0.170
## Max. :0.320
##
## depthError magError magNst status
## Min. :0.250 Min. :0.1420 Min. : 4.0 Length:5
## 1st Qu.:0.260 1st Qu.:0.1477 1st Qu.: 4.0 Class :character
## Median :0.380 Median :0.1535 Median : 6.0 Mode :character
## Mean :0.392 Mean :0.1535 Mean : 29.2
## 3rd Qu.:0.490 3rd Qu.:0.1593 3rd Qu.: 17.0
## Max. :0.580 Max. :0.1650 Max. :115.0
## NA's :3
## locationSource magSource date
## Length:5 Length:5 Min. :2019-11-26 00:06:03
## Class :character Class :character 1st Qu.:2019-11-27 09:59:00
## Mode :character Mode :character Median :2019-11-28 06:00:17
## Mean :2019-11-27 22:25:12
## 3rd Qu.:2019-11-28 23:10:59
## Max. :2019-11-29 00:49:42
##
## year month day class
## Min. :2019 Min. :11 Min. :26.0 Negative:0
## 1st Qu.:2019 1st Qu.:11 1st Qu.:27.0 Zero :0
## Median :2019 Median :11 Median :28.0 First :0
## Mean :2019 Mean :11 Mean :27.6 Second :0
## 3rd Qu.:2019 3rd Qu.:11 3rd Qu.:28.0 Third :5
## Max. :2019 Max. :11 Max. :29.0 Fourth :0
## Fifth :0
Mapping of earthquakes with Magtitute
## [1] "sf" "data.frame"
## Registered S3 method overwritten by 'xts':
## method from
## as.zoo.xts zoo
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
## Highcharts (www.highcharts.com) is a Highsoft software product which is
## not free for commercial and Governmental use
## Loading required package: sp
## rgdal: version: 1.4-8, (SVN revision 845)
## Geospatial Data Abstraction Library extensions to R successfully loaded
## Loaded GDAL runtime: GDAL 2.2.3, released 2017/11/20
## Path to GDAL shared files: C:/Users/Joe/Documents/R/win-library/3.6/rgdal/gdal
## GDAL binary built with GEOS: TRUE
## Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
## Path to PROJ.4 shared files: C:/Users/Joe/Documents/R/win-library/3.6/rgdal/proj
## Linking to sp version: 1.3-2