So what I am doing is creating a heatmap for x and y coordinates. But I would like to do this for every 30 minute interval. For example the first heatmap will be created using the data from "00:00:00" to "00:30:00", then the next from "00:01:00" to "00:31:00".
What I need help with is writing a for loop that can extract these rows from a larger database and then spit out the heatmap for each bracket of data.
The database has three columns x, y, and indiv.times. x and y are the coordinate systems and indiv.times is a character variable which contains the times in the format "13:04:46" for example.
for (i in ???) {
kde <- kde2d(x, y)
plot_ly(z = kde$z, type = "heatmap")
}
This is the code to create the heatmap so I really just need a way to extract the 30 minute intervals.
Any help would be greatly appreciated.
EDIT:
Here is a sample of the database:
structure(list(x = c(224.7666, 223.3886, 131.7025, 345.333),
y = c(60.7657, 85.73872, 77.35342, 26.24607), indiv.times = c("14:00:02",
"14:00:02", "14:00:03", "05:10:26")), class = "data.frame", row.names = c(NA, -4L))