An object of class bbmm, which is a list with vectors x, y and probabilities.
levels
A numeric vector of desired contour levels (e.g., c(95, 99)).
locations
(optional) data frame or matrix of x and y coordinates for original
location data used to estimate the Brownian bridge and utilization distribution surface.
plot
Logical. If TRUE, the countour plot is drawn.
Value
An list with four components.
Components of the returned object are as follows:
contour
Requested contour level(s).
z
values that separate the specified contour level(s).
Author(s)
Ryan Nielson, Hall Sawyer, and Trent McDonald (WEST, Inc., www.west-inc.com)
data(locations)
BBMM <- brownian.bridge(x=locations$x, y=locations$y,
time.lag=locations$time.lag[-1], location.error=20,
cell.size=50)
contours <- bbmm.contour(BBMM, levels=c(95, 99), locations=locations, plot=TRUE)
# Create a shapefile with contour lines
# Not run: library(maptools)
# Not run: library(raster)
# Not run: out <- data.frame(x=BBMM$x,y=BBMM$y,z=BBMM$probability)
# Make sure the data is properly projected
# Not run: out.raster <- rasterFromXYZ(out,crs=CRS("+proj=utm +zone=12 +datum=WGS84"),digits=2)
# Not run: raster.contour <- rasterToContour(out.raster,levels=contours$Z)
# Not run: raster.contour <- spChFIDs(raster.contour,paste(c(95, 99),"% Contour Line",sep=""))
# Not run: library(rgdal) # can't be loaded before CRS call in line above
# Not run: writeOGR(obj=raster.contour,dsn=".",layer="BBMM",driver="ESRI Shapefile")
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(BBMM)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/BBMM/bbmm.contour.Rd_%03d_medium.png", width=480, height=480)
> ### Name: bbmm.contour
> ### Title: Create density contours from a Brownian bridge movement model
> ### Aliases: bbmm.contour
> ### Keywords: ~contour ~Ascii
>
> ### ** Examples
>
> data(locations)
> BBMM <- brownian.bridge(x=locations$x, y=locations$y,
+ time.lag=locations$time.lag[-1], location.error=20,
+ cell.size=50)
> contours <- bbmm.contour(BBMM, levels=c(95, 99), locations=locations, plot=TRUE)
>
> # Create a shapefile with contour lines
> # Not run: library(maptools)
> # Not run: library(raster)
> # Not run: out <- data.frame(x=BBMM$x,y=BBMM$y,z=BBMM$probability)
> # Make sure the data is properly projected
> # Not run: out.raster <- rasterFromXYZ(out,crs=CRS("+proj=utm +zone=12 +datum=WGS84"),digits=2)
> # Not run: raster.contour <- rasterToContour(out.raster,levels=contours$Z)
> # Not run: raster.contour <- spChFIDs(raster.contour,paste(c(95, 99),"% Contour Line",sep=""))
> # Not run: library(rgdal) # can't be loaded before CRS call in line above
> # Not run: writeOGR(obj=raster.contour,dsn=".",layer="BBMM",driver="ESRI Shapefile")
>
>
>
>
>
>
> dev.off()
null device
1
>