search for: selectcols

Displaying 1 result from an estimated 1 matches for "selectcols".

Did you mean: selectcode
2012 Oct 11
1
replacing ugly for loops
...that sequence. Obviously I could do this with nested for loops,e.g.. > seq <- c(1,1,2,2) > startNo <- c(3, 10, 3, 15) > len <- c(4, 2, 5, 3) > data.df <- data.frame(seq, startNo, len) > > seq.f <- factor(data.df$seq) > data.l <- split(data.df, seq.f) > selectColsList<- vector("list", length(levels(seq.f))) > for (i in seq_along(levels(seq.f))){ selectCols <- numeric() for (j in seq_along(data.l[[i]]$startNo)){ selectCols <- c(selectCols, data.l[[i]]$startNo[j]:(data.l[[i]]$startNo[j] data.l[[i]]$len[j]-...