I have a set of places for animals with different sampling intervals. What I want to do is group and label sequences where the sampling interval meets certain criteria (for example, below a certain value). This is a revision of this issue , which has been noted as a duplicate of this . The difference in this revised question is that all values ββthat DO NOT meet the criteria should be ignored, not marked.
Let me illustrate some dummy data:
start <- Sys.time() timediff <- c(rep(5,3),rep(20,3),rep(5,2)) timediff <- cumsum(timediff)
Using the @Josh O'Brien answer , you can define a function that groups values ββthat match certain criteria.
number.groups <- function(input){ input[is.na(input)] <- FALSE
The problem is that lines 4 and 5 are marked as separate groups and not ignored. Is there a way to make sure that values ββthat DO NOT belong to the group are not grouped (for example, remain NA)?
source share