Homework Week4
Todo
- The usual instructions. Directory =
w4
. - Write a table class that reads in data from disk, and maintains one
num
orsym
instance for each column.as you read in data from disk, update each header, incrementally. - When the data quits, spit out the statistic on each column. You results should look something like the following:
n mode frequency
1 outlook 14 sunny 5
3 wind 14 FALSE 8
4 !play 14 yes 9
n mu sd
2 $temp 14 73.57 6.57
n mode frequency
1 %outlook 28 sunny 10
4 wind 28 FALSE 16
5 !play 28 yes 18
n mu sd
2 $temp 28 73.57 6.45
3 <humid 28 81.64 10.09
n mode frequency
1 %cylinders 398 4 204
7 origin 398 1 249
n mu sd
2 $displacement 398 193.43 104.27
3 $horsepower 392 104.47 38.49
4 <weight 398 2970.42 846.84
5 >acceltn 398 15.57 2.76
6 $model 398 76.01 3.70
8 >mpg 398 23.84 8.34
Before the last data set: some of its numbers are "?" which means "do not know". You'll have to skip over that code.
Sample code (in Lua)
- This files reads in data. The first row is translated into a column header and the others into rows of data rows.lua.