Skip to content

Commit bd1ce9d

Browse files
committed
m
1 parent 674d728 commit bd1ce9d

File tree

8 files changed

+21
-23
lines changed

8 files changed

+21
-23
lines changed

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
useDynLib(terra, .registration=TRUE)
22
import(methods, Rcpp)
33
exportClasses(SpatExtent, SpatRaster, SpatRasterDataset, SpatRasterCollection, SpatVector, SpatVectorProxy, SpatVectorCollection)
4-
exportMethods("[", "[[", "!", "%in%", activeCat, "activeCat<-", "add<-", addCats, adjacent, all.equal, aggregate, allNA, align, animate, anyNA, app, Arith, approximate, as.bool, as.int, as.contour, as.lines, as.points, as.polygons, as.raster, as.array, as.data.frame, as.factor, as.list, as.logical, as.matrix, as.numeric, atan2, atan_2, autocor, barplot, blocks, boundaries, boxplot, buffer, cartogram, categories, cats, catalyze, chunk, clamp, clamp_ts, classify, clearance, cellSize, cells, cellFromXY, cellFromRowCol, cellFromRowColCombine, centroids, click, bestMatch, colFromX, colFromCell, colorize, coltab, "coltab<-", combineGeoms, compare, concats, Compare, compareGeom, contour, convHull, countNA, costDist, crds, cover, crop, crosstab, crs, "crs<-", datatype, deepcopy, delaunay, densify, density, depth, "depth<-", depthName, "depthName<-", depthUnit, "depthUnit<-", describe, diff, disagg, direction, distance, divide, dots, draw, droplevels, elongate, emptyGeoms, erase, extend, ext, "ext<-", extract, extractRange, expanse, fillHoles, fillTime, flip, focal, focal3D, focalPairs, focalReg, focalCpp, focalValues, forceCCW, freq, gaps, geom, geomtype, getTileExtents, global, gridDistance, gridDist, has.colors, has.RGB, has.time, hull, hasMinMax, hasValues, hist, head, identical, ifel, impose, init, image, inext, interpIDW, interpNear, inMemory, inset, interpolate, intersect, is.bool, is.int, is.num, is.lonlat, is.rotated, isTRUE, isFALSE, is.empty, is.factor, is.flipped, is.lines, is.points, is.polygons, is.related, is.valid, k_means, lapp, layerCor, levels, "levels<-", linearUnits, lines, Logic, varnames, "varnames<-", logic, longnames, "longnames<-", simplifyLevels, makeValid, mask, match, math, Math, Math2, mean, median, meta, merge, mergeLines, mergeTime, minmax, modal, mosaic, na.omit, none, not.na, NAflag, "NAflag<-", nearby, nearest, ncell, ncol, "ncol<-", nlyr, "nlyr<-", noNA, normalize.longitude, nrow, "nrow<-", nseg, nsrc, origin, "origin<-", pairs, panel, patches, perim, persp, plot, plotRGB, plet, prcomp, princomp, RGB, "RGB<-", polys, points, predict, project, quantile, query, rangeFill, rapp, rast, rasterize, rasterizeGeom, rasterizeWin, readStart, readStop, readValues, rectify, regress, relate, removeDupNodes, res, "res<-", resample, rescale, rev, rcl, roll, rotate, rowFromY, rowColCombine, rowColFromCell, rowFromCell, sapp, scale, scale_linear, scoff, "scoff<-", sds, sort, sprc, sel, selectRange, setMinMax, setValues, segregate, selectHighest, set.cats, set.crs, set.ext, set.names, set.RGB, set.values, set.window, size, sharedPaths, shift, sieve, simplifyGeom, snap, sources, spatSample, split, spin, stdev, stretch, subset, subst, summary, Summary, surfArea, svc, symdif, t, metags, "metags<-", tail, tapp, terrain, thresh, tighten, makeNodes, makeTiles, time, timeInfo, "time<-", text, toMemory, trans, trim, units, union, "units<-", unique, unwrap, update, vect, values, "values<-", viewshed, voronoi, vrt, weighted.mean, where.min, where.max, which.lyr, which.min, which.max, which.lyr, width, window, "window<-", writeCDF, writeRaster, wrap, wrapCache, writeStart, writeStop, writeVector, writeValues, xmin, xmax, "xmin<-", "xmax<-", xres, xFromCol, xyFromCell, xFromCell, ymin, ymax, "ymin<-", "ymax<-", yres, yFromCell, yFromRow, zonal, zoom, cbind2, readRDS, saveRDS, unserialize, serialize, xapp, area, colSums, rowSums, colMeans, rowMeans)
4+
exportMethods("[", "[[", "!", "%in%", activeCat, "activeCat<-", "add<-", addCats, adjacent, all.equal, aggregate, allNA, align, animate, anyNA, app, Arith, approximate, as.bool, as.int, as.contour, as.lines, as.points, as.polygons, as.raster, as.array, as.data.frame, as.factor, as.list, as.logical, as.matrix, as.numeric, atan2, atan_2, autocor, barplot, blocks, boundaries, boxplot, buffer, cartogram, categories, cats, catalyze, chunk, clamp, clamp_ts, classify, clearance, cellSize, cells, cellFromXY, cellFromRowCol, cellFromRowColCombine, centroids, click, bestMatch, colFromX, colFromCell, colorize, coltab, "coltab<-", combineGeoms, compare, concats, Compare, compareGeom, contour, convHull, countNA, costDist, crds, cover, crop, crosstab, crs, "crs<-", datatype, deepcopy, delaunay, densify, density, depth, "depth<-", depthName, "depthName<-", depthUnit, "depthUnit<-", describe, diff, disagg, direction, distance, divide, dots, draw, droplevels, elongate, emptyGeoms, erase, extend, ext, "ext<-", extract, extractRange, expanse, fillHoles, fillTime, flip, focal, focal3D, focalPairs, focalReg, focalCpp, focalValues, forceCCW, freq, gaps, geom, geomtype, getTileExtents, global, gridDistance, gridDist, has.colors, has.RGB, has.time, hull, hasMinMax, hasValues, hist, head, identical, ifel, impose, init, image, inext, interpIDW, interpNear, inMemory, inset, interpolate, intersect, is.bool, is.int, is.num, is.lonlat, is.rotated, isTRUE, isFALSE, is.empty, is.factor, is.flipped, is.lines, is.points, is.polygons, is.related, is.valid, k_means, lapp, layerCor, levels, "levels<-", linearUnits, lines, Logic, varnames, "varnames<-", logic, longnames, "longnames<-", simplifyLevels, makeValid, mask, match, math, Math, Math2, mean, median, meta, merge, mergeLines, mergeTime, minmax, modal, mosaic, na.omit, nany, not.na, NAflag, "NAflag<-", nearby, nearest, ncell, ncol, "ncol<-", nlyr, "nlyr<-", noNA, normalize.longitude, nrow, "nrow<-", nseg, nsrc, origin, "origin<-", pairs, panel, patches, perim, persp, plot, plotRGB, plet, prcomp, princomp, RGB, "RGB<-", polys, points, predict, project, quantile, query, rangeFill, rapp, rast, rasterize, rasterizeGeom, rasterizeWin, readStart, readStop, readValues, rectify, regress, relate, removeDupNodes, res, "res<-", resample, rescale, rev, rcl, roll, rotate, rowFromY, rowColCombine, rowColFromCell, rowFromCell, sapp, scale, scale_linear, scoff, "scoff<-", sds, sort, sprc, sel, selectRange, setMinMax, setValues, segregate, selectHighest, set.cats, set.crs, set.ext, set.names, set.RGB, set.values, set.window, size, sharedPaths, shift, sieve, simplifyGeom, snap, sources, spatSample, split, spin, stdev, stretch, subset, subst, summary, Summary, surfArea, svc, symdif, t, metags, "metags<-", tail, tapp, terrain, thresh, tighten, makeNodes, makeTiles, time, timeInfo, "time<-", text, toMemory, trans, trim, units, union, "units<-", unique, unwrap, update, vect, values, "values<-", viewshed, voronoi, vrt, weighted.mean, where.min, where.max, which.lyr, which.min, which.max, which.lyr, width, window, "window<-", writeCDF, writeRaster, wrap, wrapCache, writeStart, writeStop, writeVector, writeValues, xmin, xmax, "xmin<-", "xmax<-", xres, xFromCol, xyFromCell, xFromCell, ymin, ymax, "ymin<-", "ymax<-", yres, yFromCell, yFromRow, zonal, zoom, cbind2, readRDS, saveRDS, unserialize, serialize, xapp, area, colSums, rowSums, colMeans, rowMeans)
55

66
exportMethods(watershed, pitfinder, NIDP, flowAccumulation)
77

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
## new
2424

2525
- `proj_ok` helper function to check if the GDAL/PROJ install is functional [#1996](https://github.com/rspatial/terra/issues/1996) by Andrew Gene Brown
26-
- `none<SpatRaster>` method (`!all` in one step)
26+
- `nany<SpatRaster>` method (`!all` in one step) "nany" is short for "not any". This is used because "none" creates a conflict
2727

2828

2929
# version 1.8-87

R/Agenerics.R

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
#if (!isGeneric("#")) { setGeneric("#", function(x, ...) standardGeneric("#")) }
22
#if (!isGeneric("prcomp")) {setGeneric("prcomp", function(x, ...) standardGeneric("princomp"))}
33

4-
5-
64
## ADDED BY ecor
75
if (!isGeneric("watershed")) {setGeneric("watershed", function(x, ...) standardGeneric("watershed"))}
86
if (!isGeneric("pitfinder")) {setGeneric("pitfinder", function(x, ...) standardGeneric("pitfinder"))}
97
if (!isGeneric("NIDP")) {setGeneric("NIDP", function(x, ...) standardGeneric("NIDP"))}
108
if (!isGeneric("flowAccumulation")) {setGeneric("flowAccumulation", function(x, ...) standardGeneric("flowAccumulation"))}
119

12-
13-
if (!isGeneric("none")) {setGeneric("none", function(x, ...) standardGeneric("none"))}
10+
if (!isGeneric("nany")) {setGeneric("nany", function(x, ...) standardGeneric("nany"))}
1411
if (!isGeneric("chunk")) {setGeneric("chunk", function(x, ...) standardGeneric("chunk"))}
1512
if (!isGeneric("thresh")) {setGeneric("thresh", function(x, ...) standardGeneric("thresh"))}
1613
if (!isGeneric("divide")) {setGeneric("divide", function(x, ...) standardGeneric("divide"))}

R/Arith_generics.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ setMethod("countNA", signature(x="SpatRaster"),
428428
)
429429

430430

431-
setMethod("none", signature(x="ANY"),
431+
setMethod("nany", signature(x="ANY"),
432432
function(x, ...) {
433433
!any(x, ...)
434434
}
@@ -613,7 +613,7 @@ setMethod("Summary", signature(x="SpatVector"),
613613
)
614614

615615

616-
setMethod("none", signature(x="SpatRaster"),
616+
setMethod("nany", signature(x="SpatRaster"),
617617
function(x, ..., na.rm=FALSE) {
618618
.summarize(x, ..., fun="none", na.rm=na.rm)
619619
}

R/extract_single.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ setMethod("[", c("SpatRaster", "ANY", "ANY", "ANY"),
259259
return(.extract_spatraster(x, i, drop))
260260
}
261261
if (inherits(i, "SpatVector")) {
262-
return(.extract_spatextent(x, i, drop))
262+
return(.extract_spatvector(x, i, drop))
263263
}
264264
if (inherits(i, "SpatVector")) {
265265
return(.extract_spatextent(x, i, drop))

R/vect.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,15 +306,16 @@ setReplaceMethod("[[", c("SpatVector", "character"),
306306
return(x);
307307
} else if (length(value) == 0) {
308308
if (nrow(x) == 0) {
309-
print("here")
310309
d <- values(x)
311310
for (name in i) {
312311
d[[name]] <- value
313312
}
314313
values(x) <- d
315314
return(x)
316315
} else {
317-
error("[[<-,SpatVector", "cannot use an empty value")
316+
values(x) <- NA
317+
#error("[[<-,SpatVector", "cannot use an empty value")
318+
return(x)
318319
}
319320
}
320321
if (inherits(value, "data.frame")) {

man/summarize-generics.Rd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
\alias{which.max}
1313
\alias{any}
1414
\alias{all}
15-
\alias{none}
15+
\alias{nany}
1616
\alias{prod}
1717
\alias{range}
1818
\alias{sum}
@@ -34,8 +34,8 @@
3434

3535
\alias{any,SpatRaster-method}
3636
\alias{all,SpatRaster-method}
37-
\alias{none,SpatRaster-method}
38-
\alias{none,ANY-method}
37+
\alias{nany,SpatRaster-method}
38+
\alias{nany,ANY-method}
3939
\alias{prod,SpatRaster-method}
4040
\alias{range,SpatRaster-method}
4141
\alias{sum,SpatRaster-method}
@@ -54,7 +54,7 @@
5454

5555
Compute summary statistics for cells, either across layers or between layers (parallel summary).
5656

57-
The following summary methods are available for SpatRaster: \code{any, anyNA, all, allNA, none, noNA, max, min, mean, median, prod, range, stdev, sum, which.min, which.max}. See \code{\link{modal}} to compute the mode and \code{\link{app}} to compute summary statistics that are not included here.
57+
The following summary methods are available for SpatRaster: \code{any, anyNA, all, allNA, nany, noNA, max, min, mean, median, prod, range, stdev, sum, which.min, which.max}. See \code{\link{modal}} to compute the mode and \code{\link{app}} to compute summary statistics that are not included here. \code{nany} stands for "not any" or "none" and allows to do \code{!all(x)} in one computation instead of two.
5858

5959
Because generic functions are used, the method applied is chosen based on the first argument: "\code{x}". This means that if \code{r} is a SpatRaster, \code{mean(r, 5)} will work, but \code{mean(5, r)} will not work.
6060

@@ -83,7 +83,7 @@ This is different than the sample standard deviation returned by \code{sd} (whic
8383

8484
\S4method{all}{SpatRaster}(x, ..., na.rm=FALSE)
8585

86-
\S4method{none}{SpatRaster}(x, ..., na.rm=FALSE)
86+
\S4method{nany}{SpatRaster}(x, ..., na.rm=FALSE)
8787

8888
\S4method{range}{SpatRaster}(x, ..., na.rm=FALSE)
8989

src/Makevars.ucrt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ endif
1313
##PKG_CXXFLAGS += -Wconversion -Wno-sign-conversion
1414
##CXX_STD = CXX
1515

16-
#all: clean winlibs
16+
all: clean winlibs
1717

18-
#winlibs:
19-
# cp -r "$(R_TOOLS_SOFT)/share/gdal" ../inst/
20-
# cp -r "$(R_TOOLS_SOFT)/share/proj" ../inst/
18+
winlibs:
19+
cp -r "$(R_TOOLS_SOFT)/share/gdal" ../inst/
20+
cp -r "$(R_TOOLS_SOFT)/share/proj" ../inst/
2121

22-
#clean:
23-
# rm -f $(SHLIB) $(OBJECTS)
22+
clean:
23+
rm -f $(SHLIB) $(OBJECTS)
2424

25-
#.PHONY: all winlibs clean
25+
.PHONY: all winlibs clean
2626

0 commit comments

Comments
 (0)