Removing time series with only zero values from a data frame

前端 未结 3 1787
感情败类
感情败类 2021-01-13 20:35

I have a data frame with multiple time series identified by uniquer id\'s. I would like to remove any time series that have only 0 values.

The data frame looks as fo

3条回答
  •  清酒与你
    2021-01-13 21:06

    An easy plyr solution would be

    ddply(mydat,"id",function(x) if (all(x$value==0)) NULL else x)
    

    (seems to work OK) but there may be a faster solution with data.table ...

提交回复
热议问题