dt2Convexhull | R Documentation |
data.frame to data.table with column for convex hull geometry by ID
dt2Convexhull(d, pid, y = "y", x = "x", dt = "time", projection)
d |
a data.frame including points which belong to clusters (tdbscan output), latitude, longitude and datetime |
pid |
ID unique for points that belong to one cluster |
y |
column name (character vector). The latitude. |
x |
column name (character vector). The longitude. |
dt |
column name (character vector). datetime |
projection |
character vector. if missing will default to '"+proj=utm +zone=4 +datum=WGS84"' with a warning. |
a data.table with geometry column (convex hull polygons) and connected arrival and departure datetime
require(data.table)
data(zbird)
z = tdbscan(zbird, eps = 12, minPts = 5, maxLag = 5, borderPoints = TRUE )
z = z[, clustID := factor(clustID)]
o = data.frame(zbird) %>% data.table
o = merge(z, o, by.x = 'id', by.y = 'sp.ID')
o = rbindlist(list(copy(o[, tagID := 'bird1']), copy(o[, tagID := 'bird2'])), use.names = TRUE)
o[tagID == 'bird2', x := x + 5]
o[tagID == 'bird2', x := x + 5]
o[!is.na(clustID), ID := paste0(tagID, '_', clustID)]
d = dt2Convexhull(o, pid = 'ID', projection = '+proj=utm +zone=4 +datum=WGS84')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.