{"id":107,"date":"2012-06-24T01:32:38","date_gmt":"2012-06-23T22:32:38","guid":{"rendered":"http:\/\/ekqvist.goeuropeinfo.com\/rbloggerqvist\/?p=107"},"modified":"2012-06-24T01:32:38","modified_gmt":"2012-06-23T22:32:38","slug":"r-and-earthquake-data","status":"publish","type":"post","link":"https:\/\/science.ekqvist.fi\/blogi\/r_maps_spatial\/r-and-earthquake-data\/","title":{"rendered":"R and Earthquake data"},"content":{"rendered":"<h1>Earth quakes of the last 30 days<\/h1>\n<p>These example come from <a href=\"http:\/\/www.inside-r.org\/packages\/cran\/googleVis\/docs\/gvisGeoMap\" target=\"_blank\">here<\/a>. I follow instruction how to plot earthquage data into world map between 24.5. &#8211; 23.6.2012. My first test is not succesfull, so I make my copy paste tricks. Final result show now &#8220;right&#8221; magnitude.<\/p>\n<p><a href=\"http:\/\/science.ekqvist.fi\/blogi\/wp-content\/uploads\/2012\/06\/magnitude_over_4_2305_240612.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-111\" title=\"magnitude_over_4_2305_240612\" src=\"http:\/\/science.ekqvist.fi\/blogi\/wp-content\/uploads\/2012\/06\/magnitude_over_4_2305_240612-300x188.jpg\" alt=\"\" width=\"300\" height=\"188\" \/><\/a><\/p>\n<p><code>## Plot world wide earth quakes of the last 30 days with magnitude &gt;= 4.0<br \/>\nlibrary(googleVis)<br \/>\nlibrary(XML)<br \/>\n## Get earthquake data of the last 30 days<br \/>\n## That is ok, put for some reason I do not get right magnitude into picture.<br \/>\neq=readHTMLTable(readLines(\"http:\/\/www.iris.edu\/seismon\/last30.html\"))<br \/>\neq &lt;- eq[[2]] ## extract the eq table<br \/>\nsummary(eq)<br \/>\n#something wrong with this\u00a0 last30 file<br \/>\n#I have to copy and paste web-page data into Notepad and saved this into file earthquake.txt<br \/>\n#eq &lt;- read.table(\"j:\/todo\/R_geodata\/earthquake.txt\", header=TRUE, sep=\"\\t\", na.strings=\"NA\", dec=\".\", strip.white=TRUE)<br \/>\n#WEB-server datafile note I change MAG into magni<br \/>\neq &lt;- read.table(\"http:\/\/ekqvist.goeuropeinfo.com\/rbloggerqvist\/data\/earthq\/earthquake.txt\", header=TRUE, sep=\"\\t\", na.strings=\"NA\", dec=\".\", strip.white=TRUE)<\/code><\/p>\n<p><code># lat and lon must be the same variable<br \/>\neq$loc=paste(eq$LAT, eq$LON, sep=\":\") ## create a lat:long location variable<\/code><\/p>\n<p><code># making geomap<br \/>\nearthq &lt;- gvisGeoMap(eq, locationvar=\"loc\", numvar=\"magni\", hovervar=\"DATE\", options=list(dataMode=\"markers\"))<\/code><\/p>\n<p><code>#plotting results into html file<br \/>\n#plot(earthq)<br \/>\ncat(earthq$html$chart, file=\"j:\/todo\/R_geodata\/earthq.html\")<\/code><\/p>\n<p><code><a href=\"http:\/\/ekqvist.goeuropeinfo.com\/rbloggerqvist\/data\/earthq\/earthq.html\" target=\"_blank\">By clicking this link you will see the result file<\/a>.<\/code><\/p>\n<p>Please, be patient because it takes about 30sec to open&#8230;.<\/p>\n<p>Greetings,<\/p>\n<p>Marko<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Earth quakes of the last 30 days These example come from here. I follow instruction how to plot earthquage data into world map between 24.5. &#8211; 23.6.2012. My first test is not succesfull, so I make my copy paste tricks. Final result show now &#8220;right&#8221; magnitude. ## Plot world wide earth quakes of the last <a class=\"read-more-excerpt\" href=\"https:\/\/science.ekqvist.fi\/blogi\/r_maps_spatial\/r-and-earthquake-data\/\">[&#8230;] Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"gallery","meta":[],"categories":[22,23],"tags":[32,35,48],"_links":{"self":[{"href":"https:\/\/science.ekqvist.fi\/blogi\/wp-json\/wp\/v2\/posts\/107"}],"collection":[{"href":"https:\/\/science.ekqvist.fi\/blogi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/science.ekqvist.fi\/blogi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/science.ekqvist.fi\/blogi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/science.ekqvist.fi\/blogi\/wp-json\/wp\/v2\/comments?post=107"}],"version-history":[{"count":0,"href":"https:\/\/science.ekqvist.fi\/blogi\/wp-json\/wp\/v2\/posts\/107\/revisions"}],"wp:attachment":[{"href":"https:\/\/science.ekqvist.fi\/blogi\/wp-json\/wp\/v2\/media?parent=107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/science.ekqvist.fi\/blogi\/wp-json\/wp\/v2\/categories?post=107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/science.ekqvist.fi\/blogi\/wp-json\/wp\/v2\/tags?post=107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}