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" <www...@gmail.com>
Date:    Fri, October 1, 2010 1:55 pm
To:      mlar...@rsmas.miami.edu
Cc:      r-help@r-project.org
--------------------------------------------------------------------------

Try this:

x[is.finite(x)]


On Fri, Oct 1, 2010 at 2:51 PM, <mlar...@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@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
   Try this:
   x[is.finite(x)]

   On Fri, Oct 1, 2010 at 2:51 PM, <[1]mlar...@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
     ______________________________________________
     [2]r-h...@r-project.org mailing list
     [3]https://stat.ethz.ch/mailman/listinfo/r-help
     PLEASE do read the posting guide
     [4]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

References

   1. mailto:mlar...@rsmas.miami.edu
   2. mailto:R-help@r-project.org
   3. https://stat.ethz.ch/mailman/listinfo/r-help
   4. http://www.R-project.org/posting-guide.html
______________________________________________
R-help@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.

Reply via email to