put.data: Spatial Join of Points with Raster Grids - replace data

Description Usage Arguments Details Value Author(s) Examples

View source: R/put.data.R

Description

put.data replaces data in raster object of class 'asc' (this and adehabitat package) at specified locations.

Note: there is no interpolation done here. The values given replace the values of the raster cell the point falls into.

Usage

1
put.data(pts, x)

Arguments

pts

a three-column data frame or matrix with the x and y coordinates of the locations of interest and the third column being the z values to put in the ascii grid file.

x

a raster matrix of class 'asc' (this and the adehabitat package)

Details

Implements a faster version of 'join.asc' from the adehabitat package.

NOTE: this assumes all locations are within the extent of the raster map. Values outside the extent will be given a value of NA.

Value

Returns a raster matrix of class 'asc' equal in size to input 'x'.

Author(s)

Jeremy VanDerWal jjvanderwal@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#create a simple object of class 'asc'
tasc = as.asc(matrix(1:50,nr=50,nc=50)); print(tasc)
## Not run: image(tasc)

#define some point locations
points = data.frame(x=runif(25,1,50),y=runif(25,1,50),z=50)

#put the new data
tasc = put.data(points,tasc)

#show the data
## Not run: image(tasc)

SDMTools documentation built on Jan. 11, 2020, 9:23 a.m.

Related to put.data in SDMTools...