問題タブ [difftime]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
r - タイムスタンプ付きのランレングス エンコーディングの使用
私の目的は、このrle()
関数を使用して、自転車置き場がどれくらい空いているかを調べることです。test
以下のデータを使用するrle(test$bikes)
と、 の繰り返し値の長さが返されtest$bikes
ます。
私の目標は、さらに一歩進んで、 でグループ化され、繰り返しゼロがあるstaiton_id
場合にのみ時間差 (分) を返す出力を生成することです。test$bikes
これは、ステーションごとに複数回発生する可能性があります (たとえば、test
データ内のステーション 5 の場合)。最終的に、上記のデータセットは次の出力を生成します。
これを行う方法についての提案をdplyr
いただけれrle
ば幸いです。
テストデータは次のとおりです。