Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion R/LonLat2XY.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
#' @export
#' @examples
#'
#' LonLat2XY(13, 60, 4)
#'
#' \dontrun{
#' \donttest{
#' gc <- geocode('baylor university')
#' LonLat2XY(gc$lon, gc$lat, 10)
#'
Expand Down
5 changes: 0 additions & 5 deletions R/XY2LonLat.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,9 @@
#' @export
#' @examples
#'
#'
#' \dontrun{
#' XY2LonLat(480, 845, zoom = 11)
#' XY2LonLat(0, 0, zoom = 1)
#' XY2LonLat(0, 0, 255, 255, zoom = 1)
#' XY2LonLat(0, 0, 255, 255, zoom = 1)
#'
#' }
#'
XY2LonLat <- function(X, Y, zoom, x = 0, y = 0, xpix=255, ypix=255){
n <- 2^zoom
Expand Down
2 changes: 1 addition & 1 deletion R/bb2bbox.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' @export
#' @examples
#'
#' \dontrun{# cut down on R CMD check time
#' \donttest{# cut down on R CMD check time
#'
#' # grab a center/zoom map and compute its bounding box
#' gc <- geocode("white house, washington dc")
Expand Down
4 changes: 2 additions & 2 deletions R/file_drawer.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
#' @keywords internal
#' @examples
#'
#' \dontrun{# if server is unresponsive, R check will fail
#'
#' file_drawer()
#' dir(file_drawer())
#'
#' \donttest{# if server is unresponsive, R check will fail
#'
#' # The first time you run this, the tiles are downloaded from the server
#' map <- get_stamenmap()
#' # The second time, the local cache is used so it's much faster
Expand Down
14 changes: 7 additions & 7 deletions R/geocode.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@
#' @export
#' @examples
#'
#' \dontrun{ # Server response can be slow; this cuts down check time.
#'
#' ##### basic usage
#' ########################################
#'
#' geocode("ninos", inject = "region=es", urlonly = TRUE)
#'
#' \donttest{ # Server response can be slow; this cuts down check time.
#' geocode("houston texas")
#' geocode("1600 pennsylvania avenue, washington dc")
#' geocode("the white house")
#' geocode(c("the white house", "washington dc"))
#' # see also mutate_geocode()
#' geocode("ninos", inject = "region=es", urlonly = TRUE)
#'
#'
#' ##### types of output
Expand All @@ -58,22 +58,22 @@
#' geocode("houston texas", output = "more")
#' geocode("Baylor University", output = "more")
#' str(geocode("Baylor University", output = "all"))
#' }
#'
#'
#' \dontrun{
#' ##### interfacing with the google geocoding api
#' ########################################
#'
#' register_google(key = "your code here")
#' geocode("houston texas")
#' }
#'
#'
#' \donttest{
#' # see how many requests we have left with google
#' geocodeQueryCheck()
#' geocode("one bear place, waco, texas")
#' geocode("houston texas", force = TRUE)
#'
#'
#'
#' ##### known issues
#' ########################################
#' # sources often have a hard time reliably geocoding colloquial place names
Expand Down
2 changes: 1 addition & 1 deletion R/geom_leg.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' @export
#' @examples
#'
#' \dontrun{ # removed for R CMD check speed
#' \donttest{ # removed for R CMD check speed
#'
#' map <- get_map(
#' location = c(-77.0425, 38.8925), # painfully picked by hand
Expand Down
14 changes: 6 additions & 8 deletions R/get_googlemap.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,9 @@
#' @export
#' @examples
#'
#' \dontrun{ # to diminish run check time
#'
#'
#' get_googlemap(urlonly = TRUE)
#'
#' \donttest{ # to diminish run check time
#' ggmap(get_googlemap())
#'
#'
Expand All @@ -100,24 +99,23 @@
#' # (make your graphics device as large as possible)
#' ggmap(get_googlemap(center, scale = 1), extent = "panel") # pixelated
#' ggmap(get_googlemap(center, scale = 2), extent = "panel") # fine
#' }
#'
#' \dontrun{
#' # archiving; note that you must meet google's terms for this condition
#' map <- get_googlemap(archiving = TRUE)
#' map <- get_googlemap()
#' ggmap(map)
#' }
#'
#'
#' \donttest{
#' # style
#' map <- get_googlemap(
#' maptype = "roadmap",
#' style = c(feature = "all", element = "labels", visibility = "off"),
#' color = "bw"
#' )
#' ggmap(map)
#'
#'
#'
#'
#' }
#'
get_googlemap <- function(
Expand Down
10 changes: 8 additions & 2 deletions R/get_map.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,22 @@
#' str(map)
#' ggmap(map)
#'
#' \dontrun{
#' \donttest{
#' # not run by check to reduce time; also,
#' # osm may error due to server overload
#'
#' (map <- get_map(maptype = "roadmap"))
#' }
#'
#' \dontrun{
#' (map <- get_map(source = "osm"))
#' }
#'
#' \donttest{
#' (map <- get_map(source = "stamen", maptype = "watercolor"))
#'
#' map <- get_map(location = "texas", zoom = 6, source = "stamen")
#' ggmap(map, fullpage = TRUE)
#' ggmap(map, extent = "device")
#'
#' }
get_map <- function(
Expand Down
2 changes: 1 addition & 1 deletion R/get_navermap.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#' @export
#' @examples
#'
#' \dontrun{
#' \donttest{
#' # not run to reduce R CMD check time
#'
#' map <- get_navermap(key="c75a09166a38196955adee04d3a51bf8", uri="www.r-project.org")
Expand Down
35 changes: 17 additions & 18 deletions R/get_stamenmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,24 @@
#' @export
#' @examples
#'
#' \dontrun{ # to diminish run check time
#' get_stamenmap(urlonly = TRUE)
#'
#' \donttest{
#' # since mid-2016, stamen's terrain tileset is available for
#' # the entire globe
#' place <- "mount everest"
#' (google <- get_googlemap(place, zoom = 9))
#' ggmap(google)
#' bbox_everest <- c(left = 86.05, bottom = 27.21, right = 87.81, top = 28.76)
#' ggmap(get_stamenmap(bbox_everest, zoom = 9))
#'
#' # here's an interesting example:
#' us <- c(left = -125, bottom = 25.75, right = -67, top = 49)
#' map <- get_stamenmap(us, zoom = 5, maptype = "toner-labels")
#' ggmap(map)
#' }
#'
#' \dontrun{ # to diminish run check time
#'
#' ##### basic usage
#' ########################################
Expand All @@ -49,16 +65,6 @@
#' # ggmap(get_stamenmap(bbox, zoom = 17))
#'
#'
#'
#' # since mid-2016, stamen's terrain tileset is available for
#' # the entire globe
#' place <- "mount everest"
#' (google <- get_googlemap(place, zoom = 9))
#' ggmap(google)
#' bbox_everest <- c(left = 86.05, bottom = 27.21, right = 87.81, top = 28.76)
#' ggmap(get_stamenmap(bbox_everest, zoom = 9))
#'
#'
#' # note that the osm code may not run due to overloaded
#' # servers.
#'
Expand Down Expand Up @@ -111,13 +117,6 @@
#' geom_point(aes(x = lon, y = lat), data = gc, colour = "red", size = 2)
#'
#'
#' # here's an interesting example:
#' us <- c(left = -125, bottom = 25.75, right = -67, top = 49)
#' map <- get_stamenmap(us, zoom = 5, maptype = "toner-labels")
#' ggmap(map)
#'
#'
#'
#' # accuracy check - white house
#' gc <- geocode("the white house")
#'
Expand Down
2 changes: 1 addition & 1 deletion R/ggimage.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#' ggimage(t(img[,4:1]), fullpage = FALSE)
#'
#'
#' \dontrun{
#' \donttest{
#' # not run due to slow performance
#'
#' data(hadley)
Expand Down
2 changes: 1 addition & 1 deletion R/ggmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#' @export ggmap inset inset_raster
#' @examples
#'
#' \dontrun{## map queries drag R CMD check
#' \donttest{## map queries drag R CMD check
#'
#'
#' ## extents and legends
Expand Down
11 changes: 9 additions & 2 deletions R/mapdist.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#' \url{http://code.google.com/apis/maps/documentation/distancematrix/}
#' @export
#' @examples
#' mapdist("waco, texas", "houston, texas", urlonly = TRUE)
#'
#' \dontrun{# online queries draw R CMD check times
#'
Expand All @@ -38,13 +39,17 @@
#' mapdist(from, to)
#' mapdist(from, to, mode = "bicycling")
#' mapdist(from, to, mode = "walking")
#' }
#'
#' \dontrun{
#' # google requires a key for mode="transit"
#' register_google(key = "[your key here]")
#' from <- "city hall houston texas"
#' to <- "nrg stadium houston texas"
#' mapdist(from, to, mode = "transit")
#' }
#'
#' \donttest{
#' from <- c("houston", "houston", "dallas")
#' to <- c("waco, texas", "san antonio", "houston")
#' mapdist(from, to)
Expand Down Expand Up @@ -79,7 +84,8 @@ mapdist <- function(from, to, mode = c("driving","walking","bicycling","transit"

# format basic url
origins <- URLencode(df$from[1], reserved = TRUE)
destinations <- URLencode(df$to, reserved = TRUE)
destinations <- vapply(df$to, URLencode, "", reserved = TRUE,
USE.NAMES = FALSE)
posturl <- paste(
fmteq(origins), fmteq(destinations, paste, collapse = "|"),
fmteq(mode), fmteq(language),
Expand Down Expand Up @@ -150,7 +156,8 @@ mapdist <- function(from, to, mode = c("driving","walking","bicycling","transit"
tree$rows[[c(1,1)]]
}

out <- dlply(from_to_df, "from", getdists)
if(urlonly) return(daply(unique(from_to_df), "from", getdists))
out <- dlply(unique(from_to_df), "from", getdists)

# return all
if(output == "all") return(out)
Expand Down
3 changes: 1 addition & 2 deletions R/mutate_geocode.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@
#' @export
#' @examples
#'
#'
#' \donttest{ # Server response can be slow; this cuts down check time.
#' df <- data.frame(
#' address = c("1600 Pennsylvania Avenue, Washington DC", "", "houston texas"),
#' stringsAsFactors = FALSE
#' )
#'
#' \dontrun{ # Server response can be slow; this cuts down check time.
#' mutate_geocode(df, address)
#'
#'
Expand Down
8 changes: 7 additions & 1 deletion R/qmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,20 @@
#' @export
#' @examples
#'
#' \dontrun{
#' \donttest{
#' # these examples have been excluded for checking efficiency
#'
#' location <- "marrs mclean science, waco, texas"
#' qmap(location)
#' qmap(location, zoom = 14)
#' }
#'
#' \dontrun{
#' qmap(location, zoom = 14, source = "osm")
#' qmap(location, zoom = 14, source = "osm", scale = 20000)
#' }
#'
#' \donttest{
#' qmap(location, zoom = 14, maptype = "satellite")
#' qmap(location, zoom = 14, maptype = "hybrid")
#' qmap(location, zoom = 14, maptype = "toner", source = "stamen")
Expand Down
20 changes: 6 additions & 14 deletions R/qmplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#' @export
#' @examples
#'
#' \dontrun{ # these are skipped to conserve R check time
#' \donttest{ # these are skipped to conserve R check time
#'
#' qmplot(lon, lat, data = crime)
#'
Expand Down Expand Up @@ -117,9 +117,9 @@
#' scale_alpha("Wind Speed\nand\nDirection", range = c(.1, .75)) +
#' guides(fill = guide_legend(), alpha = guide_legend())
#'
#' } # end donttest
#'
#'
#'
#' \dontrun{
#' ## kriging
#' ############################################################
#' # the below examples show kriging based on undeclared packages
Expand All @@ -128,9 +128,7 @@
#' # they also require the rgdal library
#'
#'
#' library(lattice)
#' library(sp)
#' library(rgdal)
#' if (require("lattice") && require("sp") && require("rgdal")) {
#'
#' # load in and format the meuse dataset (see bivand, pebesma, and gomez-rubio)
#' data(meuse)
Expand Down Expand Up @@ -159,10 +157,8 @@
#'
#'
#'
#'
#'
#' if (require("gstat")) { # still requiring lattice, sp and rgdal
#' # load in the meuse.grid dataset (looking toward kriging)
#' library(gstat)
#' data(meuse.grid)
#' coordinates(meuse.grid) <- c("x", "y")
#' proj4string(meuse.grid) <- CRS("+init=epsg:28992")
Expand Down Expand Up @@ -252,11 +248,7 @@
#' ) +
#' scale +
#' scale_size("Observed\nLog Zinc")
#'
#'
#'
#'
#'
#' }} # end two cases of if (require ...)
#'
#' } # end dontrun
#'
Expand Down
Loading