Generate a column of random numbers

24 views
Skip to first unread message

Ville Rantanen

unread,
Aug 9, 2013, 8:19:48 AM8/9/13
to andur...@googlegroups.com
bogusInput=StringInput(content="Foo\n")
RandomData = CSVTransformer(csv1=bogusInput,
                  transform1
="runif(100, min=0, max=100)",
                  transform2
="rnorm(100, mean=0, sd=5)",
                  transform3
="sample(1:100, 100)",
                  columnNames
="c('Data1','Data2','Data3')")


Here, using CSVTransformer component:
  • There's a compulsory input file, thus we create an empty bogus one
  • First column uses uniform distribution function with min/max
  • Second, a normal distr, wit mean and standard deviation
  • Third is a random unique sampling, between 1-100, using all 100 numbers

Ville Rantanen

unread,
Aug 9, 2013, 9:01:00 AM8/9/13
to andur...@googlegroups.com
Note, that while this example does not now use an input, it is presented here because sometimes you may want to generate randomness based on the input. If you simply really want random numbers without an input reference, use the Randomizer component
Reply all
Reply to author
Forward
0 new messages