Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
rhijmans committed Oct 9, 2023
1 parent c5fb48b commit 5a4c18a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
8 changes: 6 additions & 2 deletions R/generics.R
Original file line number Diff line number Diff line change
Expand Up @@ -974,8 +974,12 @@ setMethod("stretch", signature(x="SpatRaster"),
function(x, minv=0, maxv=255, minq=0, maxq=1, smin=NA, smax=NA, histeq=FALSE, scale=1, maxcell=500000, filename="", ...) {
if (histeq) {
if (nlyr(x) > 1) {
warn("stretch", "only the first layer of x is used")
x <- x[[1]]
x <- lapply(1:nlyr(x), function(i) stretch(x[[i]], histeq=TRUE, scale=scale, maxcell=maxcell))
x <- rast(x)
if (filename != "") {
x <- writeRaster(x, filename=filename, ...)
}
return(x)
}
scale <- scale[1]
if (scale == 1) {
Expand Down
7 changes: 7 additions & 0 deletions R/geom.R
Original file line number Diff line number Diff line change
Expand Up @@ -718,3 +718,10 @@ setMethod("forceCCW", signature(x="SpatVector"),
messages(x)
}
)


setMethod("is.empty", signature(x="SpatVector"),
function(x) {
nrow(x) == 0
}
)
2 changes: 0 additions & 2 deletions man/geomtype.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ Get the geometry type (points, lines, or polygons) of a SpatVector. See \code{\l
\usage{
\S4method{geomtype}{SpatVector}(x)

\S4method{datatype}{SpatVector}(x)

\S4method{is.points}{SpatVector}(x)

\S4method{is.lines}{SpatVector}(x)
Expand Down
5 changes: 2 additions & 3 deletions man/is.bool.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ The values in a SpatRaster layer are by default numeric, but they can also be se

For a \code{SpatRaster}, \code{as.logical} and \code{isTRUE} is equivalent to \code{as.bool}. \code{isFALSE} is equivalent to \code{!as.bool}, and \code{as.integer} is the same as \code{as.int}.

\code{as.bool} and \code{as.int} force the values into the correct range (e.g. whole integers) but in-memory cell values are still stored as numeric. They will behave like the assigned types, though, and will be written to files with that data type (if the file type supports it).

See \code{\link{levels}} and \code{\link{cats}} to create categorical layers by setting labels.
}

Expand All @@ -44,9 +46,6 @@ See \code{\link{levels}} and \code{\link{cats}} to create categorical layers by
\S4method{as.factor}{SpatRaster}(x)
}

\description{
\code{as.bool} and \code{as.int} force the values into the correct range (e.g. whole integers) but in-memory cell values are still stored as numeric. They will behave like the assigned types, though, and will be written to files with that data type (if the file type supports it).
}

\arguments{
\item{x}{SpatRaster}
Expand Down
5 changes: 5 additions & 0 deletions man/is.valid.Rd
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
\name{is.valid}

\alias{is.empty}
\alias{is.valid}
\alias{is.valid,SpatVector-method}
\alias{is.valid,SpatExtent-method}
Expand All @@ -19,6 +20,10 @@ Check the validity of polygons or attempt to fix it. Or check the validity of a
\S4method{makeValid}{SpatVector}(x)

\S4method{is.valid}{SpatExtent}(x)

\S4method{is.empty}{SpatExtent}(x)

\S4method{is.empty}{SpatVector}(x)
}

\arguments{
Expand Down

0 comments on commit 5a4c18a

Please sign in to comment.