nest_windows: Nest data into windows

Description Usage Arguments Details Value Examples

View source: R/wf_moving_window.R

Description

Creates a nested data.frame from an mv_wind object

Usage

1
nest_windows(dat, mv_wind)

Arguments

dat

[data.frame] A data.frame with location data for one individual. Should have same columns as dat for fit_locoh().

mv_wind

[mv_wind] An mv_wind object returned by construct_windows().

Details

Uses sqldf() to join locations to windows that they fall within. Then uses nest() to create a nested data.frame holding the location data in a list column.

Value

Returns a nested data.frame (a tbl) with columns:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 

# Load lubridate
library(lubridate)

# Load data
data(tracks)

# Keep 1 individual
tk1 <- tracks[which(tracks$id == "ID01"), ]

# Construct moving windows
wind <- construct_windows(start = ymd_hms("2021-05-15 00:00:00"),
                          width = days(5),
                          step = days(2),
                          end = ymd_hms("2021-06-30 00:00:00"))

#Nest
nst <- nest_windows(tk1, wind)


## End(Not run)

bsmity13/LoCoHverlap documentation built on Feb. 15, 2021, 12:43 p.m.