# You can learn more about package authoring with RStudio at:
#
# http://r-pkgs.had.co.nz/
#
# Some useful keyboard shortcuts for package authoring:
#
# Build and Reload Package: 'Ctrl + Shift + B'
# Check Package: 'Ctrl + Shift + E'
# Test Package: 'Ctrl + Shift + T'
# mapView <- 'Paris'
# testDF <- data.frame(lat=c(48.875403,48.904567,48.846674),
# lng=c(2.317795,2.255450,2.382460))
# map <- leaflet(testDF)
# class(map)
# data(LatitudesLongitudes, package = 'MyMaps')
SetMapView <- function(map,mapView) {
expect_class(map,c("leaflet","htmlwidget"),info="Wrong class for map")
expect_class(mapView,"character",info="Wrong class for mapView")
data(LatitudesLongitudes, package = 'R.Maps')
expect_in(mapView,names(LatitudesLongitudes),info='View not available')
latitudesLongitudesView <- LatitudesLongitudes[[mapView]]
fitBounds(map,
lat1=latitudesLongitudesView$latitude1,
lng1=latitudesLongitudesView$longitude1,
lat2=latitudesLongitudesView$latitude2,
lng2=latitudesLongitudesView$longitude2)
}
# LatitudesLongitudes <- fromJSON(file="data/LatitudesLongitudes.json")
# devtools::use_data(LatitudesLongitudes)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.