[R] NA erase your data trick

From: Anders Schwartz Corr <corr_at_fas.harvard.edu>
Date: Tue 17 May 2005 - 15:37:57 EST

Oops,

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

  1. Can I get my tcn5 back?
  2. 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
+
+         }
+ }

>


R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue May 17 15:49:18 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:46 EST