Skip to content

Commit

Permalink
fixes for CRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
thengl committed Jun 9, 2022
1 parent fce6912 commit c0c9416
Show file tree
Hide file tree
Showing 22 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion R/AAAA.R
Original file line number Diff line number Diff line change
@@ -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))){
Expand Down
2 changes: 1 addition & 1 deletion R/buffer.dist.R
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
4 changes: 2 additions & 2 deletions R/getSpatialTiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.")
}

Expand Down
4 changes: 2 additions & 2 deletions R/landgis.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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]]))
Expand Down
2 changes: 1 addition & 1 deletion R/makeTiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion R/spc.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)){
Expand Down
6 changes: 3 additions & 3 deletions R/spfkm.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")){
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion R/spsample.prob.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) &
Expand Down
6 changes: 3 additions & 3 deletions R/tile.R
Original file line number Diff line number Diff line change
Expand Up @@ -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, ...){
Expand Down Expand Up @@ -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))
}
Expand Down
12 changes: 6 additions & 6 deletions R/train.spLearner.R
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion R/tune.spLearner.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion man/buffer.dist-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/download.landgis.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/getSpatialTiles-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/makeTiles.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/spc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/spfkm.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/spsample.prob.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tile-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/train.spLearner-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/train.spLearner.matrix.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tune.spLearner-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c0c9416

Please sign in to comment.