Learn R Programming

⚠️There's a newer version (3.6-32) of this package.Take me there.

raster (version 3.5-21)

Geographic Data Analysis and Modeling

Description

Reading, writing, manipulating, analyzing and modeling of spatial data. The package implements basic and high-level functions for raster data and for vector data operations such as intersections. See the manual and tutorials on to get started.

Copy Link

Version

Install

install.packages('raster')

Monthly Downloads

107,973

Version

3.5-21

License

GPL (>= 3)

Maintainer

Robert Hijmans

Last Published

June 27th, 2022

Functions in raster (3.5-21)

KML

Write a KML or KMZ file
Extent-class

Class "Extent"
NAvalue

Set the NA value of a RasterLayer
Arith-methods

Arithmetic with Raster* objects
alignExtent

Align an extent (object of class Extent)
animate

Animate layers of a Raster* object
Logic-methods

Logical operators and functions
RGB

Create a Red-Green-Blue Raster object
bind

Bind Spatial* objects
blockSize

Block size for writing files
approxNA

Estimate values for cell values that are NA by interpolating between layers
area

Size of cells
Compare-methods

Compare Raster* objects
barplot

Bar plot of a RasterLayer
bands

Number of bands
boundaries

boundaries (edges) detection
as.list

Create a list of RasterLayer objects
as.logical

Change cell values to logical or integer values
buffer

buffer
Math-methods

Mathematical functions
brick

Create a RasterBrick object
adjacent

Adjacent cells
aggregate

Aggregate raster cells or SpatialPolygons/Lines
contour

Contour plot
Extreme coordinates

Coordinates of the Extent of a Raster object
Rcpp-class

Rcpp classes
Raster-class

Raster* classes
boxplot

Box plot of Raster objects
crop

Crop
addLayer

Add or drop a layer
atan2

Two argument arc-tangent
crosstab

Cross-tabulate
as.character

Character representation of a Raster or Extent object
Summary-methods

Summary methods
distance

Distance
autocorrelation

Spatial autocorrelation
focal

Focal values
distanceFromPoints

Distance from points
cellStats

Statistics across cells
cellFrom

Get cell, row, or column number
clamp

Clamp values
focalWeight

Focal weights matrix
as.data.frame

Get a data.frame with raster cell values, or coerce SpatialPolygons, Lines, or Points to a data.frame
hillShade

Hill shading
clearValues

Clear values
calc

Calculate
compareRaster

Compare Raster objects
cellsFromExtent

Cells from extent, and vice versa
hist

Histogram
initialize

Initialize a Raster object with values
as.matrix

Get a vector, matrix, or array with raster cell values
as.raster

Coerce to a 'raster' object
interpolate

Interpolate
corLocal

Local correlation coefficient
compareCRS

Partially compare two CRS objects
cluster

Use a multi-core cluster
disaggregate

Disaggregate
direction

Direction
nlayers

Number of layers
origin

Origin
cover

Replace NA values with values of other layers
plot

Plot a Raster* object
persp

Perspective plot
colortable

colortable
erase

dim

Dimensions of a Raster* object
density

Density plot
extend

Extend
filename

Filename
datasource

Are values in memory and/or on disk?
dataType

Data type
draw

Draw a line or polygon
filledContour

Filled contour plot
click

Query by clicking on a map
extremeValues

Minimum and maximum values
factors

Factors
drawExtent

Create an Extent object by drawing on a map
extract

Extract values from Raster objects
Extract by index

Indexing to extract values of a Raster* object
hdr

Header files
head

Show the head or tail of a Raster* object
flip

Flip
gridDistance

Distance on a grid
rasterToPolygons

Raster to polygons conversion
getValuesFocal

Get focal raster cell values
Programming

Helper functions for programming
rasterize

Rasterize points, lines, or polygons
predict

Spatial model predictions
intersect

Intersect
cut

Convert values to classes
clump

Detect clumps
extension

Filename extensions
cv

Coefficient of variation
stackSave

Save or open a RasterStack file
scale

Scale values
extent

Extent
ncell

Number or rows, columns, and cells of a Raster* object
names

Names of raster layers
isLonLat

Is this longitude/latitude data?
Slope and aspect

Slope and aspect
shift

Shift
terrain

Terrain characteristics
text

Add labels to a map
properties

Raster file properties
quantile

Raster quantiles
trim

Trim
transpose

Transpose
z-values

Get or set z-values
flowPath

Flow path
raster-package

Overview of the functions in the raster package
SampleInt

Sample integer values
readAll

Read values from disk
raster

Create a RasterLayer object
resolution

Resolution
reclassify

Reclassify
resample

Resample a Raster object
geom

Get the coordinates of a vector type Spatial* object
layerStats

Correlation and (weighted) covariance
layerize

Layerize
getValues

Get raster cell values
getValuesBlock

Get a block of raster cell values
Extent math

round Extent coordinates
round

Integer values
sampleRandom

Random sample
setValues

Set values of a Raster object
Gain and offset

Gain and offset of values on file
freq

Frequency table
match

Value matching for Raster* objects
shapefile

Read or write a shapefile
getData

Get geographic data
Summary

Summary
merge

Merge Raster* objects
image

Image
spplot

Use spplot to plot a Raster* or other object
spEasy

Create SpatialLines* or SpatialPolygons*
inifile

Read a .ini file
projectRaster

Project a Raster object
symdif

Symetrical difference
unstack

Unstack
update

Update raster cells of files (on disk)
stackSelect

Select cell values from a multi-layer Raster* object
metadata

Metadata
modal

modal value
overlay

Overlay Raster objects
projection

Get or set a coordinate reference system (projection)
pairs

Pairs plot (matrix of scatterplots)
localFun

Local functions
stretch

Stretch
mosaic

Merge Raster* objects using a function for overlapping areas
mask

Mask values in a Raster object
rasterFromCells

Subset a raster by cell numbers
rectify

rectify a Raster object
rasterFromXYZ

Create a Raster* object from x, y, z values
rowFromCell

Row or column number from a cell number
movingFun

Moving functions
rowSums

rowSums and colSums for Raster objects
replacement

Replace cell values or layers of a Raster* object
union

Union Extent or SpatialPolygons* objects
plotRGB

Red-Green-Blue plot of a multi-layered Raster object
unique

Unique values
pointDistance

Distance between points
xyFromCell

Coordinates from a row, column or cell number
rasterToContour

Raster to contour lines conversion
zApply

z (time) apply
scalebar

scalebar
select

Geometric subsetting
substitute

Substitute values in a Raster* object
subset

Subset layers in a Raster* object
rasterToPoints

Raster to points conversion
which.min

Where is the min or max value?
weighted.mean

Weighted mean of rasters
writeFormats

File types for writing
which

Which cells are TRUE?
rotate

Rotate
rotated

Do the raster cells have a rotation?
Options

Global options for the raster package
rasterTmpFile

Temporary files
sampleRegular

Regular sample
sampleStratified

Stratified random sample
setExtent

Set the extent of a RasterLayer
stackApply

Apply a function on subsets of a RasterStack or RasterBrick
setMinMax

Compute min and max values
stack

Create a RasterStack object
writeRaster

Write raster data to a file
validNames

Create valid names
validCell

Validity of a cell, column or row number
writeValues

Write values to a file
zoom

Zoom in on a map
zonal

Zonal statistics