add2map<- function(id_list, evdat, kh_mat, kh_geo, kh_ind){
add_id_2map <- function(id, evdat, kh_mat, kh_geo){
return(list("lon" = kh_geo[["df"]][kh_geo[["df"]]$label %in% recode_evloc(get_kinloc(id, evdat, kh_mat)),"lon"],
"lat" = kh_geo[["df"]][kh_geo[["df"]]$label %in% recode_evloc(get_kinloc(id, evdat, kh_mat)),"lat"]))
}
stopifnot(any(is_alive(id_list, evdat, kh_ind)==1))
outdf <- data.frame(id = id_list,
lon = NA,
lat = NA)
outdf <- outdf[outdf$id %in% outdf$id[is_alive(outdf$id, evdat, kh_ind)==1],]
for (i in 1:nrow(outdf)){
outdf[i,2:3] <- unlist(add_id_2map( outdf[i,1], evdat, kh_mat, kh_geo))
}
return(outdf[outdf$lon!=0,]
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.