study_subset: Subset camera-related data

Description Usage Arguments Value Examples

View source: R/study_subset.R

Description

Keep rows of data where start_col and (optional) end_col lie within an inclusive interval defined by study_start and study_end

Usage

1
study_subset(x, start_col, end_col = NULL, study_start, study_end)

Arguments

x

a dataframe or tibble with start and end columns

start_col

the name of the start column in x

end_col

the name of the end column in x. Default = NULL

study_start

the first part of the interval you want to subset by

study_end

the end of the interval to subset by

Value

a filtered dataframe or tibble

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
df <- data.frame(cam = c(1,1,2,2),
            datetime = as.POSIXct(c("2016-01-02 12:00:00",
                                    "2016-01-03 13:12:00",
                                    "2016-01-02 14:00:00",
                                    "2016-01-03 16:53:42"),
                                   tz = "GMT"),
                  a = c(850, 850, 1100, 1100),
                  count = c(1, 0, 0, 2))
d <- as.POSIXct(c("2016-01-01 00:00:00", "2016-01-02 23:59:59"), tz = "GMT")
study_subset(df, "datetime", NULL, d[1], d[2])

annam21/spaceNtime documentation built on Dec. 12, 2021, 2:48 a.m.