[R] simple index question

Marc Schwartz (via MN) mschwartz at mn.rr.com
Thu Jun 1 17:10:32 CEST 2006


On Thu, 2006-06-01 at 11:06 -0400, Mu Tian wrote:
> I want to get index number of 0s, like
> 
> x <- c(1, 2, 0, 3, 0, 4)
> 
> I want an output of
> 
> 3, 5
> 
> Thank you.

See ?which

> which(x == 0)
[1] 3 5


HTH,

Marc Schwartz



More information about the R-help mailing list