Guest User

Untitled

a guest
Jan 21st, 2019
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #!/usr/bin/ruby
  2. require 'descriptive_statistics'
  3. class MyList < Struct.new(:id, :name,:friends)
  4. end
  5. arr = Array.new
  6. f = File.open("test-comma.txt", "r")
  7. f.each_line { |line| words = line.split(',')
  8. p = MyList.new
  9. p.id=words[0]
  10. p.name=words[1]
  11. p.friends=words[2]
  12. arr.push(p)
  13. }
  14. f.close
  15.  
  16. arr.collect{|p| p.friends}.standard_deviation
Add Comment
Please, Sign In to add comment