Learn R Programming

briskaR (version 0.1.2)

loadIndividuals: Wrapper function loadIndividuals

Description

Wrapper function to create an Individuals object using SpatialPoints and data.frame .

The SpatialPoints object and the data.frame have to contain the same number of coordinates and rows.

Usage

loadIndividuals(objectL, sp, data, mintime, maxtime)

Arguments

objectL

a Landscape object

sp

a SpatialPoints object (individuals coordinates)

data

a data.frame containing individuals attributes. Rows numbers as individuals ID, columns names as dob (date of birth) | life_duration | toxic_threshold

mintime

Start simulation time

maxtime

End simulation time

Value

an Individuals object

Examples

Run this code
# NOT RUN {
 
library(sp)
data(maize_65)
# simulate 2 individuals coordinates (SpatialPoints object) and data:
coordinates <- SpatialPoints(matrix(c(468232.1,6259993,464848.8,6260483),ncol=2,byrow=TRUE),
proj4string=CRS("+init=epsg:2154"))
df <- data.frame("dob"=c(1,8),"life_duration"=c(20,20),
           "toxic_threshold"=c(15,15),row.names = c(1,2))
# create an Indiviudals object from previous data
ind <- loadIndividuals(objectL=maize.landscape,sp=coordinates,data=df,mintime=1,maxtime=61)
plot(maize.landscape,ind)
# }

Run the code above in your browser using DataLab