diff --git a/R/AAAA.R b/R/AAAA.R index 308ba83..7f7d8de 100644 --- a/R/AAAA.R +++ b/R/AAAA.R @@ -1,6 +1,6 @@ setClass("spLearner", slots = c(spModel = "ANY", vgmModel = "list", covariates = "SpatialPixelsDataFrame", spID = "SpatialGridDataFrame", quantregModel = "ANY"), validity = function(object) { - if(!class(object@vgmModel$observations)=="SpatialPointsDataFrame") + if(!methods::is(object@vgmModel$observations, "SpatialPointsDataFrame")) return("Expecting an object of class 'SpatialPointsDataFrame'") cn = c("cov.model", "lambda", "practicalRange") if(!all(cn %in% names(object@vgmModel$vgm))){ diff --git a/R/buffer.dist.R b/R/buffer.dist.R index cce82b5..272faba 100644 --- a/R/buffer.dist.R +++ b/R/buffer.dist.R @@ -15,7 +15,7 @@ #' @return object of class \code{SpatialPixelsDataFrame} with distances to points #' @export #' -#' @author \href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +#' @author \href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} #' #' @references #' \itemize{ diff --git a/R/getSpatialTiles.R b/R/getSpatialTiles.R index c9c58cf..9c390c2 100644 --- a/R/getSpatialTiles.R +++ b/R/getSpatialTiles.R @@ -13,7 +13,7 @@ #' @return List of object result of clipping #' @export #' -#' @author \href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +#' @author \href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} #' #' @examples #' library(sp) @@ -77,7 +77,7 @@ setMethod("getSpatialTiles", signature(obj = "Spatial"), function(obj, block.x, #' @export setMethod("getSpatialTiles", signature(obj = "ANY"), function(obj, block.x, block.y = block.x, overlap.percent = 0, limit.bbox = TRUE, return.SpatialPolygons = FALSE){ - if(!class(obj)=="GDALobj"){ + if(!methods::is(obj, "GDALobj")){ stop("Object of class \"GDALobj\" required.") } diff --git a/R/landgis.R b/R/landgis.R index e6aeab6..ab84938 100644 --- a/R/landgis.R +++ b/R/landgis.R @@ -11,7 +11,7 @@ #' @return Locally downloaded GeoTIFF. #' @export #' -#' @author \href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +#' @author \href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} #' #' @examples #' search.landgis(pattern=c("clay", "10..10cm")) @@ -23,7 +23,7 @@ download.landgis <- function(coverageId, filename, scalefactor=NULL, subset=NULL wcs.url <- paste0(service, '&request=GetCoverage&coverageId=', coverageId, subset, scalefactor) x <- utils::download.file(wcs.url, filename, quiet = silent, ...) try( obj <- rgdal::GDALinfo(filename, silent = silent) ) - if(!class(obj)=="GDALobj"){ + if(!methods::is(obj, "GDALobj")){ ## download from zenodo? x <- search.landgis(strsplit(coverageId, ":")[[1]][2]) warning(paste("WCS request exceed memory limitations. Try downloading from zenodo:\n", x[[2]])) diff --git a/R/makeTiles.R b/R/makeTiles.R index a0d3fbb..bbf3d9d 100644 --- a/R/makeTiles.R +++ b/R/makeTiles.R @@ -11,7 +11,7 @@ #' @return A regular tiling system #' @export #' -#' @author \href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +#' @author \href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} makeTiles <- function(bb, block.x, block.y, overlap.percent, limit.bbox, columns = NULL, rows = NULL){ ## number of tiles: diff --git a/R/spc.R b/R/spc.R index a4aee49..28d4eba 100644 --- a/R/spc.R +++ b/R/spc.R @@ -14,7 +14,7 @@ #' #' @note This method assumes that the input covariates are cross-correlated and hence their overlap can be reduced. The input variables are scaled by default and the missing values will be replaced with 0 values to reduce loss of data due to missing pixels. #' -#' @author \href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +#' @author \href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} #' #' @examples #' if(requireNamespace("plotKML", quietly = TRUE)){ diff --git a/R/spfkm.R b/R/spfkm.R index 000b64c..d998545 100644 --- a/R/spfkm.R +++ b/R/spfkm.R @@ -15,7 +15,7 @@ #' @return A fuzzy kmeans model #' @export #' -#' @author \href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +#' @author \href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} #' #' @examples #' if(requireNamespace("plotKML")){ @@ -60,8 +60,8 @@ setMethod("spfkm", signature(formulaString = "formula", observations = "SpatialP ## if available, use class centres: check_tc <- !is.null(class.c)&!is.null(class.sd) if(check_tc){ - if(!class(class.c)=="matrix"){ stop("Object of type 'matrix' with column names for covariates and row names correspodning to the class names required") } - if(!class(class.sd)=="matrix"){ stop("Object of type 'matrix' with column names for covariates and row names correspodning to the class names required") } + if(!methods::is(class.c, "matrix")){ stop("Object of type 'matrix' with column names for covariates and row names correspodning to the class names required") } + if(!methods::is(class.sd, "matrix")){ stop("Object of type 'matrix' with column names for covariates and row names correspodning to the class names required") } mout = list(NULL) } ## otherwise, estimate class centres using the multinomial logistic regression: diff --git a/R/spsample.prob.R b/R/spsample.prob.R index edbd25b..75c08bb 100644 --- a/R/spsample.prob.R +++ b/R/spsample.prob.R @@ -23,7 +23,7 @@ #' \item Royle, J.A., Chandler, R.B., Yackulic, C. and J. D. Nichols. (2012) Likelihood analysis of species occurrence probability from presence-only data for modelling species distributions. Methods in Ecology and Evolution. \doi{10.1111/j.2041-210X.2011.00182.x} #' } #' -#' @author \href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +#' @author \href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} #' #' @examples #' if(requireNamespace("plotKML", quietly = TRUE) & diff --git a/R/tile.R b/R/tile.R index 4272e04..79ad383 100644 --- a/R/tile.R +++ b/R/tile.R @@ -25,7 +25,7 @@ #' #' @return Regular tiling system #' -#' @author \href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +#' @author \href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} #' @export #' @docType methods setMethod("tile", signature(x = "RasterLayer"), function(x, y, block.x, tmp.file = TRUE, program, show.output.on.console = FALSE, ...){ @@ -125,11 +125,11 @@ setMethod("tile", signature(x = "RasterLayer"), function(x, y, block.x, tmp.file } layername <- basename(sub("[.][^.]*$", "", outname, perl=TRUE)) - if(class(x)=="SpatialPolygonsDataFrame"){ + if(methods::is(x, "SpatialPolygonsDataFrame")){ try(system(paste(program, '-where \"OGR_GEOMETRY=\'Polygon\'\" -f \"ESRI Shapefile\"', RSAGA::set.file.extension(outname, ".shp"), RSAGA::set.file.extension(tf, ".shp"), '-clipsrc', y[j,1], y[j,2], y[j,3], y[j,4], '-skipfailures'), show.output.on.console = show.output.on.console)) try(x.lst[[j]] <- rgdal::readOGR(normalizePath(RSAGA::set.file.extension(outname, ".shp")), layername, verbose = FALSE)) } - if(class(x)=="SpatialLinesDataFrame"){ + if(methods::is(x, "SpatialLinesDataFrame")){ try(system(paste(program, '-where \"OGR_GEOMETRY=\'Linestring\'\" -f \"ESRI Shapefile\"', RSAGA::set.file.extension(outname, ".shp"), RSAGA::set.file.extension(tf, ".shp"), '-clipsrc', y[j,1], y[j,2], y[j,3], y[j,4], '-skipfailures'), show.output.on.console = show.output.on.console)) try(x.lst[[j]] <- rgdal::readOGR(normalizePath(RSAGA::set.file.extension(outname, ".shp")), layername, verbose = FALSE)) } diff --git a/R/train.spLearner.R b/R/train.spLearner.R index c766f32..eaba4ed 100644 --- a/R/train.spLearner.R +++ b/R/train.spLearner.R @@ -23,7 +23,7 @@ #' @return Object of class \code{spLearner} #' @export #' -#' @author \href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +#' @author \href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} train.spLearner.matrix <- function(observations, formulaString, covariates, SL.library, family = stats::gaussian(), method = "stack.cv", predict.type, super.learner, subsets = 5, lambda = 0.5, cov.model = "exponential", subsample = 10000, parallel = "multicore", cell.size, id = NULL, weights = NULL, quantreg = TRUE, ...){ #if(!.Platform$OS.type=="unix") { parallel <- "seq" } tv <- all.vars(formulaString)[1] @@ -155,7 +155,7 @@ setMethod("train.spLearner", signature(observations = "data.frame", formulaStrin #' @return object of class \code{spLearner}, which contains fitted model, variogram model and spatial grid #' used for Cross-validation. #' -#' @author \href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +#' @author \href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} #' #' @note By default uses oblique coordinates (rotated coordinates) as described in Moller et al. (2020; \doi{10.5194/soil-6-269-2020}) to account for geographical distribution of values. #' By setting the \code{nearest = TRUE}, distances to nearest observations and values of nearest neighbors will be used (see: Sekulic et al, 2020; \doi{10.3390/rs12101687}). This method closely resembles geostatistical interpolators such as kriging. @@ -580,14 +580,14 @@ setMethod("predict", signature(object = "spLearner"), predict.spLearner) rm.dupl = TRUE ) { - if (class(locations) == "SpatialPoints" || - class(locations) == "SpatialPointsDataFrame" || - class(locations) == "SpatialPixelsDataFrame") { + if (methods::is(locations, "SpatialPoints") || + methods::is(locations, "SpatialPointsDataFrame") || + methods::is(locations, "SpatialPixelsDataFrame") ) { locations <- sp::coordinates(locations) } else { locations <- locations[, locations.x.y] } - if (class(observations) == "SpatialPoints" || class(observations) == "SpatialPointsDataFrame") { + if (methods::is(observations, "SpatialPoints") || methods::is(observations, "SpatialPointsDataFrame")) { variable <- observations[[zcol]] observations <- sp::coordinates(observations) } else { diff --git a/R/tune.spLearner.R b/R/tune.spLearner.R index ae9223f..a49498e 100644 --- a/R/tune.spLearner.R +++ b/R/tune.spLearner.R @@ -18,7 +18,7 @@ #' #' @return optimized object of type spLearner #' -#' @author \href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +#' @author \href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} #' #' @note Currently requires that two base learners are \code{regr.ranger} and #' \code{regr.xgboost}, and that there are at least 3 base learners in total. diff --git a/man/buffer.dist-methods.Rd b/man/buffer.dist-methods.Rd index 1386e71..4d9d2d9 100644 --- a/man/buffer.dist-methods.Rd +++ b/man/buffer.dist-methods.Rd @@ -48,5 +48,5 @@ b <- buffer.dist(meuse["zinc"], meuse.grid[1], } } \author{ -\href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +\href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} } diff --git a/man/download.landgis.Rd b/man/download.landgis.Rd index 7f4cbae..fbc5ebd 100644 --- a/man/download.landgis.Rd +++ b/man/download.landgis.Rd @@ -40,5 +40,5 @@ Access and download layers from OpenLandMap.org (LandGIS data service) search.landgis(pattern=c("clay", "10..10cm")) } \author{ -\href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +\href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} } diff --git a/man/getSpatialTiles-methods.Rd b/man/getSpatialTiles-methods.Rd index 2cd9eee..a8577b7 100644 --- a/man/getSpatialTiles-methods.Rd +++ b/man/getSpatialTiles-methods.Rd @@ -59,5 +59,5 @@ pix.lst <- tile(meuse.grid, block.x=1000) } } \author{ -\href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +\href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} } diff --git a/man/makeTiles.Rd b/man/makeTiles.Rd index cbe57c6..8f76319 100644 --- a/man/makeTiles.Rd +++ b/man/makeTiles.Rd @@ -36,5 +36,5 @@ A regular tiling system Make a tiling system from a bounding box } \author{ -\href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +\href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} } diff --git a/man/spc.Rd b/man/spc.Rd index 28d1eb2..8c99c4b 100644 --- a/man/spc.Rd +++ b/man/spc.Rd @@ -44,5 +44,5 @@ spplot(eberg_spc@predicted[1:4], at=sq, col.regions=pal) } } \author{ -\href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +\href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} } diff --git a/man/spfkm.Rd b/man/spfkm.Rd index dc56d9a..fa260be 100644 --- a/man/spfkm.Rd +++ b/man/spfkm.Rd @@ -57,5 +57,5 @@ eberg_sm <- spfkm(formulaString, eberg, eberg_spc@predicted) } } \author{ -\href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +\href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} } diff --git a/man/spsample.prob.Rd b/man/spsample.prob.Rd index c1af52e..5182a75 100644 --- a/man/spsample.prob.Rd +++ b/man/spsample.prob.Rd @@ -95,5 +95,5 @@ summary(m0)$adj.r.squared } } \author{ -\href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +\href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} } diff --git a/man/tile-methods.Rd b/man/tile-methods.Rd index 3cb5c1e..99ca2ce 100644 --- a/man/tile-methods.Rd +++ b/man/tile-methods.Rd @@ -41,5 +41,5 @@ Regular tiling system Tile spatial layers } \author{ -\href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +\href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} } diff --git a/man/train.spLearner-methods.Rd b/man/train.spLearner-methods.Rd index 7c14de9..d5f9ac2 100644 --- a/man/train.spLearner-methods.Rd +++ b/man/train.spLearner-methods.Rd @@ -227,5 +227,5 @@ while (!is.null(dev.list())) dev.off() } } \author{ -\href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +\href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} } diff --git a/man/train.spLearner.matrix.Rd b/man/train.spLearner.matrix.Rd index 051c7ed..85e6e92 100644 --- a/man/train.spLearner.matrix.Rd +++ b/man/train.spLearner.matrix.Rd @@ -71,5 +71,5 @@ Train a spatial prediction and/or interpolation model using Ensemble Machine Lea from a regression/classification matrix } \author{ -\href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +\href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} } diff --git a/man/tune.spLearner-methods.Rd b/man/tune.spLearner-methods.Rd index 09e9d57..0f262b0 100644 --- a/man/tune.spLearner-methods.Rd +++ b/man/tune.spLearner-methods.Rd @@ -83,5 +83,5 @@ if(!class(t) == "try-error") summary(m0@spModel$learner.model$super.model$learne } } \author{ -\href{https://opengeohub.org/people/tom-hengl}{Tom Hengl} +\href{https://opengeohub.org/people/tom-hengl/}{Tom Hengl} }