Skip to content

Commit

Permalink
Fixing linter warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
PMassicotte committed Jan 14, 2023
1 parent cdeb987 commit 72ac52f
Show file tree
Hide file tree
Showing 51 changed files with 1,289 additions and 1,298 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Generated by roxygen2: do not edit by hand

export(check_data_exist)
export(check_rnaturalearthdata)
export(check_rnaturalearthhires)
export(install_rnaturalearthdata)
Expand Down
64 changes: 0 additions & 64 deletions R/check_data_exist.r

This file was deleted.

36 changes: 19 additions & 17 deletions R/check_scale.r → R/check_scale.R
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
#' check that this scale is present in Natural Earth
#'
#' check name or numeric scale representations, return numeric one
#'
#' @param x scale of map to return, one of \code{110}, \code{50}, \code{10} or \code{'small'}, \code{'medium'}, \code{'large'}
#' check name or numeric scale representations, return numeric one
#'
#' @param x scale of map to return, one of \code{110}, \code{50}, \code{10} or
#' \code{'small'}, \code{'medium'}, \code{'large'}
#'
#' @examples
#' # commented out because not exported
#' # check_scale(110)
#' # check_scale("small")
#'
#'
#' @return integer scale of map


check_scale <- function(x) {


if (is.numeric(x) && length(x) == 1) {

if (x %in% c(110, 50, 10))
if (x %in% c(110, 50, 10)) {
return(x)

}
} else if (is.character(x) && length(x) == 1) {

xnew <- c(small = 110, medium = 50, large = 10)[tolower(x)]
if (!is.na(xnew))

if (!is.na(xnew)) {
return(unname(xnew))
}
}

stop("Invalid `scale`. Must be one of [110, 50, 10, 'small', 'medium', 'large'] you have :",x,"\n",
call. = FALSE)

}

stop(
"Invalid `scale`. Must be one of [110, 50, 10, 'small', 'medium', 'large'] you have :",
x,
"\n",
call. = FALSE
)
}
10 changes: 8 additions & 2 deletions R/datasets.r → R/datasets.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
#' world country polygons from Natural Earth
#'
#' at 1:110m scale (small). Other data and resolutions are in the packages rnaturalearthdata and rnaturalearthhires.
#' at 1:110m scale (small). Other data and resolutions are in the packages
#' rnaturalearthdata and rnaturalearthhires.
#'
#' @format A \code{SpatialPolygonsDataFrame}
#'
#' @slot data A data frame with country attributes
#'
#' @aliases countries110
#'
#' @name countries
NULL

#' @source \url{https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_countries.zip}
#' @source
#' \url{https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_countries.zip}
#'
#' @rdname countries
"countries110"

Expand Down
Loading

0 comments on commit 72ac52f

Please sign in to comment.