Fix small bug in size of N vs R. Also highlight important bug in generate_data()
Added function to parse input data from file