See the recent discussion about is.na() on this list.  You can do what
you want as

> x<-c(1,3,-1,0,4)
> is.na(x) = x > 0
> x
[1] NA NA -1  0 NA

Yulei He <[EMAIL PROTECTED]> writes:

> Hi, there.
> 
> Can I ask how to set up missing values in R? Suppose I want to assign the
> missing value to the elements in vector which is greater than zero like
> this:
> 
> x<-c(1,3,-1,0,4);
> 
> after the missing value assignment, x becomes (NA,NA,-1,0,NA).

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to