Hi,

try below:

x <- c(1:20)
y <- c(1, 5, 10, 14)

x[ c( (y[1]+2):(y[2]-1), (y[2]+2):(y[3]-1), (y[3]+2):(y[4]-1) ) ]
x[unlist(lapply(1:(length(y) - 1), function (i) (y[i] + 2) : (y[i + 1] - 1)))]
x[unlist(mapply(seq, y[-length(y)] + 2, y[-1] - 1, SIMPLIFY = FALSE))]

-- 
Noia Raindrops
noia.raindr...@gmail.com

______________________________________________
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.

Reply via email to