Hi Philip, Not very elegant, but: phdf<-read.table(text="Minute Second Speed 29 47 0 29 53 0 29 59 0 30 5 0 30 11 0 30 17 0 30 23 0 30 29 0 30 35 0 30 41 0 30 47 0 30 53 0 30 59 0 31 5 0 31 11 0 31 17 0.402649 31 23 0.671081 31 29 1.588225 31 35 2.438261 31 41 2.706693 31 47 2.930386 31 53 3.310666 31 59 3.198819 32 5 3.422512", header=TRUE,stringsAsFactors=FALSE) keep<-rep(TRUE,length(phdf$Speed)) for(mini in unique(phdf$Minute)) if(all(phdf$Speed[phdf$Minute == mini] == 0)) keep[phdf$Minute == mini]<-FALSE phdf<-phdf[keep,]
Jim On Sat, Aug 15, 2020 at 6:59 AM Philip <herd_...@cox.net> wrote: > > I’m trying to compare National Weather Service Rapid Update Forecast (RAP) > data to GPS breadcrumbs collected by a really clever Apple Phone Ap that lays > down longitude, latitude, altitude, compass direction, and speed every six > seconds. Below is a small subset of the GPS data from another flight. > > I want to delete the rows where the balloon does not move (Speed column) for > a full minute assuming that it is sitting on the ground – beginning of the > flight, changing passengers, or waiting for the chase crew at the end of the > flight. for example, I want to eliminate the data for minute 30 but keep the > data for minute 31 because the balloon starts to move again at second 17. > Any suggestions? I’ve tried putzing around with multiple lags without > success. > > Minute Second Speed > 29 47 0 > 29 53 0 > 29 59 0 > 30 5 0 > 30 11 0 > 30 17 0 > 30 23 0 > 30 29 0 > 30 35 0 > 30 41 0 > 30 47 0 > 30 53 0 > 30 59 0 > 31 5 0 > 31 11 0 > 31 17 0.402649 > 31 23 0.671081 > 31 29 1.588225 > 31 35 2.438261 > 31 41 2.706693 > 31 47 2.930386 > 31 53 3.310666 > 31 59 3.198819 > 32 5 3.422512 > > > It would be even better if I could delete the rows where there were ten > consecutive zero speed entries such as from minute 30 second 17 to minute 31 > second 11. > > Thanks, > Philip Heinrich > [[alternative HTML version deleted]] > > ______________________________________________ > 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. ______________________________________________ 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.