Skip to content
Prev 361948 / 398506 Next

Subscripting problem with is.na()

Hello,

You could do

ds_test[is.na(ds_test$var1), ] <- 0? # note the comma

or, more generally,

ds_test[] <- lapply(ds_test, function(x) {x[is.na(x)] <- 0; x})

Hope this helps,

Rui Barradas
?

Citando G.Maubach at weinwolf.de:
?