[R] NA erase your data trick

Daniel Nordlund res90sx5 at verizon.net
Tue May 17 08:11:38 CEST 2005



> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch]
> On Behalf Of Anders Schwartz Corr
> Sent: Monday, May 16, 2005 10:38 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] NA erase your data trick
> 
> 
> 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?

I don't think there is any going back.

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

How about something like

x[x == -9] <- NA

Dan Nordlund
Bothell, WA

> 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 at 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




More information about the R-help mailing list