-
Notifications
You must be signed in to change notification settings - Fork 0
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
46b7421
commit 9acf673
Showing
4 changed files
with
54 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export("%notin%") | ||
export(misc_sanitizeNames) | ||
export(sp_replaceGriddedNA) | ||
export(sp_resampleRas) |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#' Inverse of 'in' call | ||
#' | ||
#' @description | ||
#' Calculates the set of entries not present in the second vector. | ||
#' Added for convenience since this is not supported by default in R. | ||
#' | ||
#' @param a First [`vector`] object. | ||
#' @param b Second [`vector`] object. | ||
#' | ||
#' @returns A [`vector`] of [`logical`] entries of \code{'a'} not present in \code{'b'}. | ||
#' @examples | ||
#' # example code | ||
# lu <- c("Forest", "Cropland", "Wetland", "OtherLand") | ||
# lu2 <- c("Forest", "Wetland", "otherland") | ||
# which(lu %notin% lu2) | ||
#' @keywords utils | ||
#' @author Martin Jung | ||
#' @export | ||
`%notin%` = function(a, b){!(a %in% b)} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,3 +1,9 @@ | ||
test_that("Basic unit tests for misc functions", { | ||
test_that("Basic unit tests for small misc functions", { | ||
expect_equal(misc_sanitizeNames("Climate-temperature2015"), "Climate_temperature2015") | ||
|
||
# Not in function\ | ||
lu <- c("Forest", "Cropland", "Wetland", "OtherLand") | ||
lu2 <- c("Forest", "Wetland", "otherland") | ||
test <- which(lu %notin% lu2) | ||
expect_equal(test, c(2,4)) | ||
}) |