[R] NA erase your data trick

Anders Schwartz Corr corr at fas.harvard.edu
Tue May 17 07:37:57 CEST 2005


Oops,

I just erased all my data using this gizmo that I thought would replace -9
with NA.

A) Can I get my tcn5 back?

B) How do I do it right next time, I learned my lesson, I'll never do it
again, I promise!

Anders Corr

> for(i in 1:dim(tcn5)[2]){         ##for the number of columns
+     for(n in 1:dim(tcn5)[1]){     ##for the number of rows
+         tcn5[is.na(tcn5[n,i]) | tcn5[n,i] == -9] <- NA
+
+         }
+ }
>




More information about the R-help mailing list