eqdata<-read.table(text="",col.names=c("time", "longitude", "latitude", "depth", "mag")) ymd<-seq(as.Date("2016-04-01"),as.Date("2016-10-20"), by="1 day") for (i in 1:length(ymd)){ date<-gsub("-","",ymd[i]) url<-paste0("http://www.data.jma.go.jp/svd/eqev/data/daily_map/",date,".html") doc<-readLines(url,encoding ="UTF-8") kensaku<-paste0(substr(date,1,4)," ",gsub("\\<0"," ",substr(date,5,6))," ",gsub("\\<0"," ",substr(date,7,8))) x<-doc[grep(paste0("\\<",kensaku),doc)] x<-gsub("°", " ",x) time<-paste0(substr(x,1,4),"-",substr(x,6,7),"-",substr(x,9,10)," ",substr(x,12,16),":",substr(x,18,21)) latitude = as.numeric(paste0(substr(x,23,23),as.character(as.numeric(substr(x,24,25))+as.numeric(substr(x,28,29))/60+as.numeric(substr(x,31,31))/600))) longitude = as.numeric(paste0(substr(x,34,34),as.character(as.numeric(substr(x,35,37))+as.numeric(substr(x,40,41))/60+as.numeric(substr(x,43,43))/600))) depth<-as.numeric(substr(x,48,50)) mag<-as.numeric(substr(x,55,58)) eq<-data.frame(time,longitude,latitude,depth,mag) eqdata<-rbind(eqdata,subset(eq,mag>=-4)) } eqdata<-unique(eqdata) summary(eqdata) load("eqdatah2015.RData") eq<-eqdata load("eqdatah201601.RData") eq<-rbind(eq,eqdata) load("eqdatah201602.RData") eq<-rbind(eq,eqdata) load("eqdatah201603.RData") eq<-rbind(eq,eqdata) load("eqdata20160401_1020.RData") eq<-rbind(eq,eqdata) eqdata<-eq rm(eq) summary(eqdata)
|