Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Binning

18 views
Skip to first unread message

WJ

unread,
Jul 23, 2016, 4:41:03 PM7/23/16
to
Create a vector of random integers, and then group them this way.

Bin 1: numbers >= 0 and < 9
Bin 2: numbers >= 9 and < 24
Bin 2: numbers >= 24

R:

xs = sample(0:29, 24, rep=TRUE)
xs

[1] 21 4 13 25 12 25 9 27 23 5 22 25 23 19 1 12 19 19 24 10 13 28 9 22


locs = findInterval(xs, c(0, 9, 24))
list(xs[locs==1], xs[locs==2], xs[locs==3])

[[1]]
[1] 4 5 1

[[2]]
[1] 21 13 12 9 23 22 23 19 12 19 19 10 13 9 22

[[3]]
[1] 25 25 27 25 24 28

Let's see the ANS Forth version.

--
The former leader of the National Front Jean-Marie Le Pen was fined 30,000
euros for exposing the Jews Holocaust gas chamber hoax.
infostormer.com/jean-marie-le-pen-fined-30000-euros-for-exposing-jewish-holocaust-gas-chamber-hoax
0 new messages