-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cdeb987
commit 72ac52f
Showing
51 changed files
with
1,289 additions
and
1,298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.