File: addLayer.Rd

package info (click to toggle)
r-cran-raster 3.6-31-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 3,300 kB
  • sloc: cpp: 2,367; ansic: 1,572; sh: 13; makefile: 2
file content (43 lines) | stat: -rw-r--r-- 946 bytes parent folder | download | duplicates (2)
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
40
41
42
43
\name{addLayer}

\alias{addLayer}
\alias{addLayer,Raster-method}
\alias{dropLayer}
\alias{dropLayer,RasterStack-method}
\alias{dropLayer,RasterBrick-method}

\title{Add or drop a layer}

\description{
Add a layer to a Raster* object or drop a layer from a RasterStack or RasterBrick. The object returned is always a RasterStack (unless nothing to add or drop was provided, in which case the original object is returned).
}

\usage{
addLayer(x, ...) 
dropLayer(x, i, ...) 
}

\arguments{
  \item{x}{Raster* object}
  \item{i}{integer. Indices of the layers to be dropped}
  \item{...}{Additional arguments. The layers to add for addLayer. None implemented for dropLayer)}
}


\value{
RasterStack
}

\seealso{ \code{\link[raster]{subset}}}

\examples{
file <- system.file("external/test.grd", package="raster")
s <- stack(file, file, file)
r <- raster(file)
s <- addLayer(s, r/2, r*2)
s
s <- dropLayer(s, c(3, 5))
nlayers(s)
}

\keyword{ spatial }