From 0aa22fdc201bf4ec7b7dff39ae9dc15d516faab1 Mon Sep 17 00:00:00 2001 From: aleksanderbl29 <73799306+aleksanderbl29@users.noreply.github.com> Date: Mon, 28 Oct 2024 15:27:22 +0100 Subject: [PATCH] fix 2 --- DESCRIPTION | 1 + R/plot_municipalities.R | 5 +++-- R/plot_regions.R | 3 ++- man/plot_municipalities.Rd | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index c07475f..fb82cfd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -22,6 +22,7 @@ Depends: R (>= 3.5.0) Imports: dawaR (>= 0.2.3), + dplyr, ggplot2 (>= 3.4.0), rlang Roxygen: list(markdown = TRUE) diff --git a/R/plot_municipalities.R b/R/plot_municipalities.R index 41f4e60..903bad9 100644 --- a/R/plot_municipalities.R +++ b/R/plot_municipalities.R @@ -3,10 +3,11 @@ #' @description #' Plot a vector of municipalities in Denmark. Just provide the name. #' -#' @param region Municipality to plot. Mutiple is supported. +#' @param municipality Municipality to plot. Mutiple is supported. #' #' @export #' @importFrom ggplot2 ggplot theme_bw labs geom_sf aes guides +#' @importFrom rlang .data #' #' @returns Returns a `{ggplot2}` object and prints the plot as well. #' @examples @@ -124,7 +125,7 @@ plot_municipalities <- function( } dawaR::get_map_data("kommuner") |> - dplyr::filter(navn %in% municipality) |> + dplyr::filter(.data$navn %in% municipality) |> ggplot() + geom_sf() + theme_bw() + diff --git a/R/plot_regions.R b/R/plot_regions.R index 9d3b7ca..8897037 100644 --- a/R/plot_regions.R +++ b/R/plot_regions.R @@ -7,6 +7,7 @@ #' #' @export #' @importFrom ggplot2 ggplot theme_bw labs geom_sf aes guides +#' @importFrom rlang .data #' #' @returns Returns a `{ggplot2}` object and prints the plot as well. #' @examples @@ -30,7 +31,7 @@ plot_regions <- function( } dawaR::get_map_data("regioner") |> - dplyr::filter(navn %in% region) |> + dplyr::filter(.data$navn %in% region) |> ggplot() + geom_sf() + theme_bw() + diff --git a/man/plot_municipalities.Rd b/man/plot_municipalities.Rd index 431e086..13de19d 100644 --- a/man/plot_municipalities.Rd +++ b/man/plot_municipalities.Rd @@ -26,7 +26,7 @@ plot_municipalities( ) } \arguments{ -\item{region}{Municipality to plot. Mutiple is supported.} +\item{municipality}{Municipality to plot. Mutiple is supported.} } \value{ Returns a \code{{ggplot2}} object and prints the plot as well.