Dear R-users,

I have some very simple data where 1's represent events and zeroes non-events, e.g.
temp <- rbind(c(0,1,0,0,1,1,1,0), c(0,0,0,1,0,0,0,0))

For each row in the matrix, I would like to replace a singelton event by a 0. That is, any 1 surrounded by zeroes (010) should be replaced by a zero (000). Sequences of 1's should be left unchanged.

So the modified matrix shoud look like this:
00001110
00000000

How can I do this in R?

Thanks,
Stacey



      __________________________________________________________________
[[elided Yahoo spam]]

	[[alternative HTML version deleted]]

