Skip to content

Commit f89bc6e

Browse files
committed
m
1 parent 844451c commit f89bc6e

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

R/subset.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,6 @@ function(x, i, j) {
103103
setMethod("subset", signature(x="SpatVector"),
104104
function(x, subset, select, drop=FALSE, NSE=FALSE) {
105105

106-
spatcls <- isTRUE(substr(class(subset)[1], 1, 4) == "Spat")
107-
if (spatcls) {
108-
return(x[subset])
109-
}
110106
if (NSE) {
111107
d <- as.list(x)
112108
# from the subset<data.frame> method
@@ -130,7 +126,13 @@ setMethod("subset", signature(x="SpatVector"),
130126
}
131127
x <- x[r, v, drop=drop]
132128
} else {
133-
if (missing(select)) {
129+
spatcls <- isTRUE(substr(class(subset)[1], 1, 4) == "Spat")
130+
if (spatcls) {
131+
x <- x[subset]
132+
if (!missing(select)) {
133+
x <- x[, select, drop=drop]
134+
}
135+
} else if (missing(select)) {
134136
x <- x[which(as.vector(subset)), drop=drop]
135137
} else {
136138
x <- x[which(as.vector(subset)), select, drop=drop]

man/distance.Rd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ If \code{y} is missing, the distance between each point in \code{x} with all oth
5151
\S4method{distance}{SpatVector,SpatVector}(x, y, pairwise=FALSE, unit="m", method="haversine", use_nodes=FALSE)
5252

5353
\S4method{distance}{SpatVector,ANY}(x, y, sequential=FALSE, pairs=FALSE, symmetrical=TRUE, unit="m",
54-
method="haversine", use_nodes=FALSE)
54+
method="haversine", use_nodes=FALSE, names=NULL)
5555

5656
\S4method{distance}{matrix,matrix}(x, y, lonlat, pairwise=FALSE, unit="m", method="geo")
5757

@@ -77,6 +77,7 @@ If \code{y} is missing, the distance between each point in \code{x} with all oth
7777
\item{pairs}{logical. If \code{TRUE} a "from", "to", "distance" matrix is returned}
7878
\item{symmetrical}{logical. If \code{TRUE} and \code{pairs=TRUE}, the distance between a pair is only included once. The distance between geometry 1 and 3 is included, but the (same) distance between 3 and 1 is not}
7979
\item{use_nodes}{logical. If \code{TRUE} and the crs is longitude/latitude, the nodes (vertices) of lines or polygons are used to compute distances, instead of the lines that connect them. This is faster, but can be less precise if the nodes are far apart}
80+
\item{names}{character. Either a single variable name in \code{x} or a vector of length \code{nrow(x)} to label the distance matrix}
8081
}
8182

8283
\value{

man/ext.Rd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
\alias{ext,sf-method}
2424
\alias{ext,bbox-method}
2525
\alias{ext,PackedSpatExtent-method}
26+
\alias{ext,SpatGraticule-method}
2627

2728
\title{Create, get or set a SpatExtent}
2829

man/plet.Rd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The arguments of \code{plet} are similar to those of \code{\link[terra]{plot}},
2626
tiles=c("Streets", "Esri.WorldImagery", "OpenTopoMap"),
2727
wrap=TRUE, maxcell=500000, stretch=NULL, legend="bottomright",
2828
shared=FALSE, panel=FALSE, collapse=TRUE, type=NULL, breaks=NULL,
29-
breakby="eqint", range=NULL, fill_range=NULL, map=NULL, ...)
29+
breakby="eqint", range=NULL, fill_range=FALSE, map=NULL, ...)
3030

3131

3232
\S4method{plet}{SpatRasterCollection}(x, col, alpha=0.8, main=names(x),

0 commit comments

Comments
 (0)