-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
From Bryan 👍
Code and two examples of the output
Bryan
sensor = window(playTR, type='auto')
#flag(playTR , 'x == 999999', 'persist(x) > 3', 'is.na(x)')
flagged <- flag(sensor,'x < 1','MAD(x,w) > 3')
flaggedout <- data.frame(flagged$sensor) %>%
add_rownames() %>%
mutate(flagged = NA_character_) %>%
mutate(flaggedyes = NA_character_)
for(ii in 1:length(flagged$flags)){
flageddata <- flagged$flags[[ii]]$flag.i
flagtype <- flagged$flags[[ii]]$expression
flaggedout%<>%
mutate_if(rowname %in% as.character(flageddata), flaggedyes = flagtype) %>%
mutate(flagged = paste2(flagged,flaggedyes)) %>%
mutate_if(flagged == "", flagged = NA) %>%
mutate(flaggedyes = NA_character_)
}
flaggedout %<>% select(-flaggedyes)
#head(data.frame(flaggedout %>% filter(!is.na(flagged))))
idx <- c(1, diff(flaggedout$times))
i2 <- c(1,which(idx > 3600), nrow(flaggedout)+1)
flaggedout$grp <- rep(1:length(diff(i2)), diff(i2))
trplot <- ggplot(flaggedout, aes(x = times, y = x) )
trplot <- trplot + geom_point(aes(colour = flagged,group = grp))
trplotMetadata
Metadata
Assignees
Labels
No labels
