Skip to content
Prev 353672 / 398503 Next

cut variable within a loop

Hi David,

Thanks for your comment. I'll explain what I want to do. I explained it
already earlier but the explanation might have gone lost in some of the
emails.

The variable irrigation ranges from 0 to 100. (maybe not in de small sample
I gave, but in reality I have over 60000 observations and there the
variable ranges from 0 to 100). I want to make (and use) 100 different
samples. The sample is based each time on the "i" that I put at the
beginning of the loop.

So:

i = 1: this means there are 2 subsets. One from 0-1, another from 1-100
i = 2: this means there are 2 subsets. One from 0-2, another from 2-100
i = 3: this means there are 2 subsets. One from 0-3, another from 3-100
i = 4: this means there are 2 subsets. One from 0-4, another from 4-100
...
i = 96: this means there are 2 subsets. One from 0-96, another from 96-100
i = 97: this means there are 2 subsets. One from 0-97, another from 97-100
i = 98: this means there are 2 subsets. One from 0-98, another from 98-100
i = 99: this means there are 2 subsets. One from 0-99, another from 99-100

It might be possible that i = 1 and i = 2 give the same results in the
small dataset. But in the full dataset all numbers are represented.

The cut2 function is capable of "cutting" a sample based on a number
supplied. Yet, when I tell him this number is "i", then it doesn't work. If
instead I write that the number is 10, then it does work and it gives me 2
subsets from 0-10 and from 10-100.

Hope this is more clear!

Janka


2015-08-14 20:10 GMT+02:00 David Winsemius <dwinsemius at comcast.net>: