> m <- matrix(sample(c(NA,1:10),100, replace =TRUE),10)> d <- as.data.frame(m)
V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
143NA376610652989510NA2172311636NA14164NA4NA7102NA4185124NA2626746NA3NANA10211084744910989410NA858321459479391019910533104225NA97255> d[is.na(d)]<-0> d
V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
143037661065298951002172311636014164040710204185124026267460300102110847449109894100858321459479391019910533104225097255
There's no need to apply apply
. =)