library(knitr) opts_chunk$set(out.extra='style="display:block; margin: auto"', fig.align="center")
Load package library
library(lubridate) library(animalmove) library(plyr)
Buffalo dataset has been saved in the package data directory , and loaded on the package load.
Raw buffalo dataset contains unaltered original data.
data(buffalo) head(buffalo) nrow(buffalo) currentnames <- colnames(buffalo) currentnames names(buffalo)[names(buffalo)=="timestamp"] <- "time" names(buffalo)[names(buffalo)=="utm.easting"] <- "x" names(buffalo)[names(buffalo)=="utm.northing"] <- "y" names(buffalo)[names(buffalo)=="tag.local.identifier"] <- "id" names(buffalo)[names(buffalo)=="individual.taxon.canonical.name"] <- "pop.type" # Data Conversion buffalo$time <- as.POSIXct(strptime(buffalo$time,format="%Y-%m-%d %H:%M",tz="GMT")) #Display new names newnames <- colnames(buffalo) newnames head(buffalo)
Number of rows in the buffalo data & data set structure
length(table((buffalo$id))) str(buffalo)
We select at most 6 individuals within 2009, time interval 50 hours, and accuracy 50 hours, and subsampling scheme for Realized Mobility Index
rmi.subsample.data <- subsample(dat=buffalo, start=c("2005-02-17 00:00:00"),end="2006-12-31 00:00:00",interval=c("48 hours"),accuracy=c("3 hours"),minIndiv=3,maxIndiv=6,mustIndiv=NULL,index.type="rmi") buffalo.indiv <- Individuals(rmi.subsample.data, id="id", time="time", x="x", y="y", group.by="pop.type", proj4string= CRS("+proj=utm +zone=28 +datum=WGS84")) head(coordinates(buffalo.indiv)) bbox(buffalo.indiv) head(show(buffalo.indiv),2) head(SpatialPoints(buffalo.indiv), 2) coordnames(buffalo.indiv) buffalo.data.attr <- as.data.frame(buffalo.indiv) head(buffalo.data.attr) buffalo.individual.mcp <- mcp(buffalo.indiv[,"id"], percent = 100) buffalo.individual.mcp buffalo.population.mcp <- mcp.population(buffalo.indiv, percent = 100) buffalo.population.mcp show.mcp(buffalo.indiv, percent = 100, id="id") print(buffalo.indiv)
Note, a number of rows in the rmi subsample dataset
nrow(rmi.subsample.data)
fg.pal <- color.palette(length(unique(buffalo.data.attr$pop.type))) bg.pal <- color.palette(length(unique(buffalo.data.attr$pop.type)), palette = c("Dark2")) plot(buffalo.individual.mcp, col=fg.pal) plot(buffalo.indiv, col="green") rmi.index.population <- rmi.index(buffalo.indiv, percent = 100, id = "id") plot(rmi.index.population)
RMI Data
rmi.index.population
rmi.index.population
summary(rmi.index.population)
plot(rmi.index.population)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.