Skip to content
Prev 307618 / 398506 Next

Converting factors to bounded random numerical data

sample(Range,1) generates 1 random number.  Change that 
(in all 3 places) to sample(Range, length(a$Z), replace=TRUE)
to get length(a$Z) random numbers in the same range.

There are other ways to do this with less typing.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com