quick way to open a map html widget in local browser (saved as tempfile you can share)
Source:R/ejam2map.R
map2browser.Rdquick way to open a map html widget in local browser (saved as tempfile you can share)
Arguments
- x
output of
ejam2map()ormapfastej()ormapfast()
Examples
pts <- testpoints_100
pts <- pts[is.finite(pts$lat) & is.finite(pts$lon), ]
mapfast(pts)
# out = ejamit(pts, radius = 1)
out <- testoutput_ejamit_100pts_1miles
# Use valid sites so the color vector matches the rows being mapped.
out$results_bysite <- out$results_bysite[out$results_bysite$valid %in% TRUE, ]
# See in RStudio viewer pane
ejam2map(out, launch_browser = FALSE)
# Color by a percentile column without manually converting its values.
ejam2map(out, color = "state.pctile.o3", launch_browser = FALSE)
mapfastej(out$results_bysite[c(12,31),])
# color-code points on map to show which ones had a high indicator score
mapfastej(out, color = EJAM:::ratio2color( out$results_bysite$ratio.to.state.avg.traffic.score))
mapfastej(out, color = EJAM:::pctile2color( out$results_bysite$state.pctile.o3))
mapfastej(out, color = EJAM:::pctile2color(out$results_bysite$pctile.Demog.Index.Supp))
if (FALSE) { # \dontrun{
out <- ejamit(fips = fips_counties_from_state_abbrev(c('KY', 'IN')))
ejam2map(out, color = EJAM:::pctile2color( out$results_bysite$state.pctile.o3))
# See in local browser instead
ejam2map(out)
# Open folder where interactive map
# .html file is saved, so you can share it:
x = ejam2map(out)
fname = map2browser(x)
# browseURL(normalizePath(dirname(fname))) # to open the temp folder
# file.copy(fname, "./map.html") # to copy map file to working directory
} # }