Re: [R] index vector

From: bertrand toupin <borghor_at_yahoo.ca>
Date: Fri 29 Sep 2006 - 20:49:59 GMT


yes, exactly! Thanks a lot for your quick answer :)

jim holtman <jholtman@gmail.com> wrote: Is this what you want?

> x <- matrix(1:25,5)
> x[c(2,5),5] <- -9999
> x

     [,1] [,2] [,3] [,4] [,5]

[1,]    1    6   11   16    21
[2,]    2    7   12   17 -9999
[3,]    3    8   13   18    23
[4,]    4    9   14   19    24
[5,]    5   10   15   20 -9999

> x[x[,5] == -9999, 5] <- NA
> x

     [,1] [,2] [,3] [,4] [,5]

[1,]    1    6   11   16   21
[2,]    2    7   12   17   NA
[3,]    3    8   13   18   23
[4,]    4    9   14   19   24
[5,]    5   10   15   20   NA

>
>

On 9/29/06, bertrand toupin wrote:
> Hi! 1st time I'm posting here. I'm beginning to learn R and I've encountered a problem that I'm unable to solve so far.
>
> I have a 20 000 x 5 matrix. In the 5th column, I have elevation. Missing value are actually put to -99999. I want to track down the index of those values and replace them with NA. I've read that to replace, the command "replace" is enough. I just don't know how to construct the index vector that contains the index of -99999 values.
>
> Hope this makes sense,
> Thanks!
> Philippe
>
>
> ---------------------------------
> Share your photos with the people who matter at Yahoo! Canada Photos
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?


 				
---------------------------------
Make free worldwide PC-to-PC calls. Try the new Yahoo! Canada Messenger with Voice
	[[alternative HTML version deleted]]

______________________________________________
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
and provide commented, minimal, self-contained, reproducible code.
Received on Sat Sep 30 06:59:48 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 29 Sep 2006 - 21:30:15 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.