Thomas > Not sure i explained it good enough. Ill try with an example > > say > > x=[3,3,4,4,4,4,5,5,6,8] > z=[3,4,4,5,5] > > what i want to get after removing z from x is something like > x=[3,4,4,6,8]
This will work, but I imagine there are better ways (assuming z is always a subset of x): z <- c(3,4,4,5,5) x <- c(3,3,4,4,4,4,5,5,6,8) tempTab <- merge(table(x), table(z), by='row.names', all=T) tempTab[is.na(tempTab[,5]),5] <- 0 rep(as.numeric(tempTab[,1]), tempTab[,3]-tempTab[,5]) Peter Alspach ______________________________________________ R-help@r-project.org 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.