# NOT RUN {
data(calves)
calves.dateTime<-datetime.append(calves, date = calves$date,
time = calves$time) #create a dataframe with dateTime identifiers for location fixes.
calves.agg<-tempAggregate(calves.dateTime, id = calves.dateTime$calftag,
dateTime = calves.dateTime$dateTime, point.x = calves.dateTime$x,
point.y = calves.dateTime$y, secondAgg = 300, extrapolate.left = FALSE,
extrapolate.right = FALSE, resolutionLevel = "reduced", parallel = FALSE,
na.rm = TRUE, smooth.type = 1) #smooth to 5-min fix intervals.
water<- data.frame(x = c(61.43315, 61.89377, 62.37518, 61.82622),
y = c(62.44815, 62.73341, 61.93864, 61.67411)) #delineate water polygon
water_poly<-data.frame(matrix(ncol = 8, nrow = 1)) #make coordinates to dist2Area specifications
colnum = 0
for(h in 1:nrow(water)){
water_poly[1,colnum + h] <- water$x[h] #pull the x location for each vertex
water_poly[1, (colnum + 1 + h)] <- water$y[h] #pull the y location for each vertex
colnum <- colnum + 1
}
water_dist<-dist2Area_df(x = calves.agg, y = water_poly,
x.id = calves.agg$id, y.id = "water", dateTime = "dateTime", point.x = calves.agg$x,
point.y = calves.agg$y, poly.xy = NULL, parallel = FALSE, dataType = "Point",
lonlat = FALSE, numVertices = NULL)
# }
Run the code above in your browser using DataLab