Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- require 'descriptive_statistics'
- class MyList < Struct.new(:id, :name,:friends)
- end
- arr = Array.new
- f = File.open("test-comma.txt", "r")
- f.each_line { |line| words = line.split(',')
- p = MyList.new
- p.id=words[0]
- p.name=words[1]
- p.friends=words[2]
- arr.push(p)
- }
- f.close
- arr.collect{|p| p.friends}.standard_deviation
Add Comment
Please, Sign In to add comment