Learn R Programming

mptools (version 1.0.1)

mp2sp: Create a SpatialPointsDataFrame describing Metapop population centroids

Description

Create a SpatialPointsDataFrame representing the centroid of each population, with attributes: pop (population name), time (the time step), and N (the mean population size).

Usage

mp2sp(mp, coords, start, s_p4s, t_p4s)

Arguments

mp
A RAMAS Metapop .mp file containing simulation results.
coords
An object containing population coordinates. This object can be created by using mp2xy
start
The value of the first timestep. If timesteps are not in increments of 1, it may be best to use start=1, in which case 'time' in the resulting shapefile's attribute table will refer to the timestep number.
s_p4s
(Optional) The coordinate reference system of the source cordinates given in coords. These can be supplied as a CRS object or as a proj4 string.
t_p4s
(Optional) The target coordinate reference system to which coordinates will be projected, if supplied. These can be supplied as a CRS object or as a proj4 string.

Value

A SpatialPointsDataFrame.

See Also

mp2xy

Examples

Run this code
mp <- system.file('example.mp', package='mptools')
r <- system.file('example_001.tif', package='mptools')
coords <- mp2xy(mp, r, 9.975)
spdf <- mp2sp(mp, coords, start=2000)
spdf

Run the code above in your browser using DataLab