I have 2 data frames:
vector1 <- c(1:24) #listing of hours
vector2 <- seq.int(.0,.60,.05) #listing of every 5 minutes
possible_hrs <- data.frame(outer(vector1,vector2,'+'))
#matrix of all possible hours/minutes
possible_hrs
#pull in start/end time possibilities
start_time <-c(5,2)
end_time <-c(8,10)
class_time<-data.frame(start_time,end_time)
class_time
I then want to be able to compare every value from both data frames against one another. I've tried something like this to no avail:
which(possible_hrs >= class_time$start & possible_hrs <= class_time$end, arr.ind=TRUE)
The end goal is to have a listing of "keys" from the class_time dataframe that corresponds to the appropriate hours of the possible_hrs dataframe, something like:
start end time
8:00 8:45 8:00
8:00 8:45 8:05
8:00 8:45 8:10
...
8:00 8:45 8:45