Replace NAs in a ffdf object

后端 未结 1 1276
孤城傲影
孤城傲影 2021-01-01 08:23

I`m working with a ffdf object which has NAs in some of the columns. The NAs are the result of a left outer merge using merge.ffdf.I would like to replace the NAs w

相关标签:
1条回答
  • 2021-01-01 09:05

    The manual of package ff indicates a function called ffindexset.

    idx <- is.na(deals$CREDIT_R) ## This uses is.na.ff_vector from ffbase
    idx <- ffwhich(idx, idx == TRUE) ## Is part of ffbase
    deals$CREDIT_R <- ffindexset(x=deals$CREDIT_R, index=idx, value=ff(0, length=length(idx), vmode = "double")) ## Is part of ff
    deals$CREDIT_R[idx] <- ff(0, length=length(idx), vmode = "double") ## this one will probably also work
    

    Also have a look at ?Extract.ff

    0 讨论(0)
提交回复
热议问题