On 2020-08-14 15:56 -0700, Bert Gunter wrote: | On Fri, Aug 14, 2020 at 3:21 PM Rasmus Liland wrote: | | | | As to Bert's reply, I am a loss as | | how to use the lengths list in | | rle(rap$Speed) for this ... | | I showed how in my message for one | interpretation of the query. I would | need further clarification for other | interpretations, but note that in my | reply, rep(z|9, z) gives a logical | vector in which all rows in which a | speed of 0 appears in a run of 10 or | greater (as no other speed would be | replicated) is TRUE, FALSE otherwise. | ( z = $lengths). I would agree that | whether this is a good starting point | for other interpretations remains to | be seen.
Yes, the time cols might be omitted to complete this. z <- rle(rap$Speed)$lengths rap[rep(x=z<10, times=z),] This is not bad. /Rasmus P.S. Adding this back to the list (this ends up in a searchable archive, and so on and so fourth).
signature.asc
Description: PGP signature
______________________________________________ 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.