Skip to content
Prev 171059 / 398503 Next

code patterns in vector

On 19/02/2009 9:26 AM, Stefan Uhmann wrote:
vec2 <- rep(0, length(vec))
vec2[grep("iss", vec)] <- 2
vec2[grep("unc", vec)] <- 1

Note that an entry containing both "unc" and "iss" will get a 1 
according to this scheme.

Duncan Murdoch