checkins_in_interval | R Documentation |
This function filters the input data frame such that the
output is a similar data frame where all entries are in the specified
period between start
and end
. The start_loc
and end_loc
parameters
specify whether or not last observations should be carried forward. If
start_loc
is TRUE
then a checkin occuring before the interval will
be carried forward so that the location appears in the output at the
beginning of the interval. If end_loc
is TRUE
then a checkin is carried
forward to the end of the interval.
checkins_in_interval(x, time, start, end, start_loc = TRUE, end_loc = TRUE)
x |
the data frame of checkins. |
time |
the column denoting the timestamp. |
start |
the beginning of the interval. |
end |
the end of the interval. |
start_loc |
should the starting location be included? Default TRUE. |
end_loc |
should the end location be included? Default TRUE. |
library(dplyr) library(lubridate) data(checkins) x <- checkins %>% filter(id == 335) %>% arrange(timestamp) start <- x$timestamp[1] minute(start) <- 0 second(start) <- 0 end <- start + hours(1) - seconds(1) checkins_in_interval(x, "timestamp", start, end)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.