On Thu, 16 Dec 2021, Chris Evans wrote:
What you said earlier was:
For me the next step, in tidyverse pseudocode, might be something like: tibData %>% arrange(nbr, datetime) %>% # just in case things are not ordered nicely group_by(site_nbr) %>% # as you want to get changes within site I think mutate(gapTime = datetime - lag(datetime)) %>% # get the simple gaps summarise(nGaps = n_distinct(gapTime)) # get the number of gaps per site
Chris, Thank you. Each tibble has the data for the same site_nbr. Your pseudocode should put me on the path to doing what I want. If the rows were grouped by the minute (the measurement variable period) ... I'll need to think deeply how only the time interval, not the individual values, could be extracted.
From what you are saying that will get you numbers of time gap changes per site. That will help you work out how many are simple failures of sensors etc. (would they come up as multiples of that site's then usual interval, or might they be more complex?) In the light of that you can start the somewhat more challenging issue of disentangling those from more long lasting switches in a site's gapTime value. I am sure I can offer some thoughts on that in the light of what you find but the best solutions will depend on the number of sites and on what those distributions of changes within site look like.
There are only four sites, and I've identified the dates and times of measurement frequencies for one of them. My interest is on when that measurement frequency changes. Because I've not before seen such frequency changes in data sets I've used for projects I've no idea whether these changes affect analytic results.
Disclaimer: I am not a professional statistician nor a professional R coder though I do spend much of each week hacking up R code that works and supports publications. Others here are professional statisticians _and_ professional R coders.
Neither am I a professional statistician nor do I use R every day or with every project. Regards, Rich ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.