[R] [Fwd: Re: cleaning up a vector]

mlarkin at rsmas.miami.edu mlarkin at rsmas.miami.edu
Fri Oct 1 20:16:26 CEST 2010


It turns out I didn't have to filter out the 1-20 values.

The code of  x[is.finite(x)] did the trick.

Thanks!!!

Mike




---------------------------- Original Message ----------------------------
Subject: Re: [R] cleaning up a vector
From:    "Henrique Dallazuanna" <wwwhsd at gmail.com>
Date:    Fri, October 1, 2010 1:55 pm
To:      mlarkin at rsmas.miami.edu
Cc:      r-help at r-project.org
--------------------------------------------------------------------------

Try this:

x[is.finite(x)]


On Fri, Oct 1, 2010 at 2:51 PM, <mlarkin at rsmas.miami.edu> wrote:

> I calculated a large vector.  Unfortunately, I have some measurement error
> in my data and some of the values in the vector are erroneous.  I ended up
> wih some Infs and NaNs in the vector.  I would like to filter out the Inf
> and NaN values and only keep the values in my vector that range from 1 to
> 20.  Is there a way to filter out Infs and NaNs in R and end up with a
> clean vector?
>
> Mike
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: untitled-2
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20101001/51d4e21c/attachment.pl>


More information about the R-help mailing list