Skip to content

Commit

Permalink
doc: document map functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ahasverus committed May 15, 2024
1 parent 11365fb commit 6bca529
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 16 deletions.
13 changes: 10 additions & 3 deletions R/geom_basemap.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
#' Add a World basemap to a ggplot object
#'
#' @description
#' This function creates a World base map that can be added to a ggplot object.
#' Creates a World base map that can be added to a `ggplot` object.
#' Spatial layers come from the Natural Earth project
#' (<https://www.naturalearthdata.com/>).
#' (<https://www.naturalearthdata.com/>) and are defnied in the Robinson
#' coordinate system.
#'
#' @return A `ggplot` object.
#'
#' @export
#'
#' @examples
#' ## ADD EXAMPLE ----
#' # Attach packages ----
#' library("forcis")
#' library("ggplot2")
#'
#' # World basemap ----
#' ggplot() +
#' geom_basemap()

geom_basemap <- function() {

Expand Down
25 changes: 20 additions & 5 deletions R/ggmap_data.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#' Plot a distribution map of FORCIS data
#' Map the spatial distribution of FORCIS data
#'
#' @description
#' This function can be used to map FORCIS data.
#' Maps the spatial distribution of FORCIS data.
#'
#' @param data a `data.frame`, i.e. a FORCIS dataset or the output of a
#' `filter_*()` function.
#' @param data a `data.frame`. One obtained by `read_*_data()` functions.
#'
#' @param col a `character` of length 1. The color of data on the map.
#'
Expand All @@ -15,7 +14,23 @@
#' @export
#'
#' @examples
#' ## ADD EXAMPLE ----
#' # Attach the package ----
#' library("forcis")
#'
#' # Import example dataset ----
#' file_name <- system.file(file.path("extdata", "FORCIS_pump_sample.csv"),
#' package = "forcis")
#'
#' pump_data <- vroom::vroom(file_name, delim = ";", show_col_types = FALSE)
#'
#' # Add 'data_type' column ----
#' pump_data$"data_type" <- "Pump"
#'
#' # Map data (default) ----
#' ggmap_data(pump_data)
#'
#' # Map data ----
#' ggmap_data(pump_data, col = "black", fill = "red", shape = 21, size = 4)

ggmap_data <- function(data, col = "red", ...) {

Expand Down
13 changes: 10 additions & 3 deletions man/geom_basemap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 20 additions & 5 deletions man/ggmap_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6bca529

Please sign in to comment.