-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_extent.Rd
39 lines (36 loc) · 1.48 KB
/
update_extent.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/spatial_tools.R
\name{update_extent}
\alias{update_extent}
\title{Shrink or expand an \code{\link[raster]{extent}} object}
\usage{
update_extent(x, x_shift, y_shift = x_shift)
}
\arguments{
\item{x}{An \code{\link[raster]{extent}} object or an object from which there is an \code{\link[raster]{extent}} method (e.g., a \code{\link[raster]{raster}}).}
\item{x_shift}{A number that defines the change in the x limits. Positive numbers increase the extent (i.e., the lower limit is reduced and the upper limit is increased) while negative numbers reduce extent (i.e., the lower limit is increased and the upper limit is decreased).}
\item{y_shift}{A number that defines the change in the y limits. By default, this equals \code{x_shift} (i.e., the \code{\link[raster]{extent}} is changed uniformly in all directions).}
}
\value{
The function returns an updated \code{\link[raster]{extent}} object.
}
\description{
This function updates a \code{\link[raster]{raster}}'s \code{\link[raster]{extent}} by shrinking or expanding the x and y limits.
}
\examples{
# Define example raster
r <- raster::raster(
nrows = 3, ncols = 3,
resolution = c(5, 5),
ext = raster::extent(0, 15, 0, 15)
)
# Increase raster extent by 5 units in every direction
update_extent(r, 5)
# Decrease raster extent by 5 units in every direction
update_extent(r, -5)
# Increase x and y extent parameters differently
update_extent(r, 5, 10)
}
\author{
Edward Lavender
}