Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- abort "usage: generate_weibull_data <mean> <iterations>" if ARGV.length != 2
- scale = ARGV[0].to_f / 2
- r_code = <<EOF
- for (i in 1:#{ARGV[1]}) {
- Wscale = #{ARGV[0]}/.43
- d = c(rweibull(100000, .5, Wscale), rweibull(100000, 1, Wscale), rweibull(100000, 10, Wscale))
- write.table(d[d < 19],
- col.names = F,
- row.names = F,
- file = paste("W_m#{ARGV[0]}_i", i, ".txt", sep = ""))
- }
- EOF
- temp_filename = %x[mktemp].chomp
- temp_file = File.new(temp_filename, "w")
- temp_file.puts(r_code)
- temp_file.close
- %x[R --vanilla --quiet CMD BATCH #{temp_filename} /dev/null]
- File.delete(temp_filename)
Add Comment
Please, Sign In to add comment