phylogeoToRasterHPD: gphylogeoToRasterHPD

Description Usage Arguments Details Value See Also Examples

View source: R/phylogeoToRasterHPD.R

Description

Extracts coordinate data from a full posterior BEAST trees file read by read.annot.beast and generates raster objects with 2d kernel HPD densities.

Usage

1
2
phylogeoToRasterHPD(trees, coordnames = NULL, intervals = NULL,
  resolution = 0.1)

Arguments

file

The path to the MCC file from BEAST

Details

Thee trees object must be multiPhylo or list. It requires two additional arguments: coordnames, which is character vector with the column names pointing to the coordinate data in the BEAST tree (see examples); and intervals, which is a numeric vector with the time intervals or slices that will be used to summarize and claculate kernel densities.

Value

raster object

See Also

raster

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
file <- system.file("data/HBV.trees", package="rBt")
trees <- read.annot.beast(file)
# remove burnin
trees <- trees[1000:10000]
# look for column names
head(trees[[1]]$metadata)
# node            locationsnewTrait
#1    1 33.3431887795,134.9307404236
#2    2 -2.3045941592,118.5275669247
#3    3  15.880672531,106.7863444469
#4    4  15.2357758333,97.1170427803
#5    5  10.826174473,100.0321841486
#6    6 11.8647366524,104.4581350327
coordnames <- "locationsnewTrait"
# set intervals
intervals <- c(0,250,500,750)
# get 95% HPD raster
st <- phylogeoToRasterHPD(trees, coordnames, intervals)
plot(st)
# add a map:
library(maptools)
data(wrld_simpl)
par(mfrow=c(2,2))
for (i in 1:dim(st)[3]){
   image(st[[i]], col=rev(terrain.colors(20)))
   plot(wrld_simpl, add=T)
}

santiagosnchez/rBt documentation built on Aug. 9, 2021, 11:52 p.m.