[R] split rows by range
JSHuang
js.huang at protective.com
Thu Jan 29 03:26:29 CET 2015
Hi,
I define a function named starStop with three inputs: start, stop and
increment.
> startStop <- function(start, stop, increment) {
+ for (i in seq(start, stop, increment+1)) cat(i,"-",i+increment,"\n")}
> startStop(12, 35, 5)
12 - 17
18 - 23
24 - 29
30 - 35
> startStop(42, 83, 5)
42 - 47
48 - 53
54 - 59
60 - 65
66 - 71
72 - 77
78 - 83
> startStop(61, 90, 5)
61 - 66
67 - 72
73 - 78
79 - 84
85 - 90
--
View this message in context: http://r.789695.n4.nabble.com/split-rows-by-range-tp4702415p4702436.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list