crews.tsv | ||
Weight | School | Rowers |
188.5 | Cambridge | 1 |
183 | Cambridge | 1 |
194.5 | Cambridge | 1 |
185 | Cambridge | 1 |
214 | Cambridge | 1 |
203.5 | Cambridge | 1 |
186 | Cambridge | 1 |
178.5 | Cambridge | 1 |
109 | Cambridge | 0 |
186 | Oxford | 1 |
184.5 | Oxford | 1 |
204 | Oxford | 1 |
184.5 | Oxford | 1 |
195.5 | Oxford | 1 |
202.5 | Oxford | 1 |
174 | Oxford | 1 |
183 | Oxford | 1 |
109.5 | Oxford | 0 |
crews.tsv
|
Download the file.
Source: http://lib.stat.cmu.edu/DASL/Datafiles/Crews.html (dead link)
J.B. Miller's code uses pylab, a procedural interface to the
matplotlib object-oriented plotting library; omitting the shell
output, here's the similar code using pyplot instead.
J.B. Miller's code uses pylab, a procedural interface to the
matplotlib object-oriented plotting library; omitting the shell
output, here's the similar code using pyplot instead.
sh-2.4$ awk '{ if (NR > 0) sum += $1 } END { print sum / 18 }' < crews.tsv
181.417
sh-2.4$
181.417
sh-2.4$
sh-4.2$ export GOPATH="/usr/share/gocode"
sh-4.2$ cat crews.go
package main
import (
"fmt"
"gonum.org/v1/gonum/stat"
)
func main() {
xs := []float64{
188.5, 183, 194.5, 185, 214, 203.5, 186, 178.5, 109,
186, 184.5, 204, 184.5, 195.5, 202.5, 174, 183, 109.5,
}
mean := stat.Mean(xs, nil)
fmt.Printf("%v\n", mean)
}
sh-4.2$ go run crews.go
181.41666666666666
sh-4.2$ exit
sh-4.2$ cat crews.go
package main
import (
"fmt"
"gonum.org/v1/gonum/stat"
)
func main() {
xs := []float64{
188.5, 183, 194.5, 185, 214, 203.5, 186, 178.5, 109,
186, 184.5, 204, 184.5, 195.5, 202.5, 174, 183, 109.5,
}
mean := stat.Mean(xs, nil)
fmt.Printf("%v\n", mean)
}
sh-4.2$ go run crews.go
181.41666666666666
sh-4.2$ exit
sh-2.4$ cat test.hs
import Statistics.Sample
import Data.Vector
cambridge = fromList [188.5, 183, 194.5, 185, 214, 203.5, 186, 178.5, 109]
main = do
print $ mean cambridge
sh-2.4$ runghc test.hs
182.44444444444446
sh-2.4$ exit
import Statistics.Sample
import Data.Vector
cambridge = fromList [188.5, 183, 194.5, 185, 214, 203.5, 186, 178.5, 109]
main = do
print $ mean cambridge
sh-2.4$ runghc test.hs
182.44444444444446
sh-2.4$ exit
sh-4.2$ cat crews.jl
#!/usr/bin/env julia
cambridge = [188.5, 183, 194.5, 185, 214, 203.5, 186, 178.5, 109]
oxford = [186, 184.5, 204, 184.5, 195.5, 202.5, 174, 183, 109.5]
crews = vcat(cambridge, oxford)
println(mean(crews))
sh-4.2$ ./crews.jl
181.41666666666666
sh-4.2$
#!/usr/bin/env julia
cambridge = [188.5, 183, 194.5, 185, 214, 203.5, 186, 178.5, 109]
oxford = [186, 184.5, 204, 184.5, 195.5, 202.5, 174, 183, 109.5]
crews = vcat(cambridge, oxford)
println(mean(crews))
sh-4.2$ ./crews.jl
181.41666666666666
sh-4.2$
sh-4.2$ pdl
perlDL shell v1.357
PDL comes with ABSOLUTELY NO WARRANTY. For details, see the file
'COPYING' in the PDL distribution. This is free software and you
are welcome to redistribute it under certain conditions, see
the same file for details.
ReadLines, NiceSlice, MultiLines enabled
Reading /home/eric/.perldlrc...
Found docs database /usr/local/lib/perl5/PDL/pdldoc.db
Type 'help' for online help
Type 'demo' for online demos
Loaded PDL v2.019 (supports bad values)
pdl> @cambridge = (188.5, 183, 194.5, 185, 214, 203.5, 186, 178.5, 109)
pdl> $piddle = pdl @cambridge
pdl> ($mean) = statsover $piddle
pdl> p $mean
182.444444444444
pdl> quit
sh-4.2$ exit
perlDL shell v1.357
PDL comes with ABSOLUTELY NO WARRANTY. For details, see the file
'COPYING' in the PDL distribution. This is free software and you
are welcome to redistribute it under certain conditions, see
the same file for details.
ReadLines, NiceSlice, MultiLines enabled
Reading /home/eric/.perldlrc...
Found docs database /usr/local/lib/perl5/PDL/pdldoc.db
Type 'help' for online help
Type 'demo' for online demos
Loaded PDL v2.019 (supports bad values)
pdl> @cambridge = (188.5, 183, 194.5, 185, 214, 203.5, 186, 178.5, 109)
pdl> $piddle = pdl @cambridge
pdl> ($mean) = statsover $piddle
pdl> p $mean
182.444444444444
pdl> quit
sh-4.2$ exit
sh-4.2$ R
R version 3.0.1 (2013-05-16) -- "Good Sport"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: i486-slackware-linux-gnu (32-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> oxford <- c(186, 184.5, 204, 184.5, 195.5, 202.5, 174, 183, 109.5)
> oxford.mean <- mean(oxford)
> print(oxford.mean)
[1] 180.3889
> q()
Save workspace image? [y/n/c]: n
sh-4.2$ exit
R version 3.0.1 (2013-05-16) -- "Good Sport"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: i486-slackware-linux-gnu (32-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> oxford <- c(186, 184.5, 204, 184.5, 195.5, 202.5, 174, 183, 109.5)
> oxford.mean <- mean(oxford)
> print(oxford.mean)
[1] 180.3889
> q()
Save workspace image? [y/n/c]: n
sh-4.2$ exit
sh-4.2$ tclsh
% set oxford [list 186 184.5 204 184.5 195.5 202.5 174 183 109.5]
186 184.5 204 184.5 195.5 202.5 174 183 109.5
% package require math::statistics
0.9.3
% puts [::math::statistics::mean $oxford]
180.38888888888889
% exit
sh-4.2$ exit
% set oxford [list 186 184.5 204 184.5 195.5 202.5 174 183 109.5]
186 184.5 204 184.5 195.5 202.5 174 183 109.5
% package require math::statistics
0.9.3
% puts [::math::statistics::mean $oxford]
180.38888888888889
% exit
sh-4.2$ exit
sh-4.2$ cd /usr/local/bin
sh-4.2$ ./xlispstat
XLISP-PLUS version 3.04
Portions Copyright (c) 1988, by David Betz.
Modified by Thomas Almy and others.
XLISP-STAT Release 3.52.20 (Beta).
Copyright (c) 1989-1999, by Luke Tierney.
> (def cambridge (list 188.5 183 194.5 185 214 203.5 186 178.5 109))
CAMBRIDGE
> (def oxford (list 186 184.5 204 184.5 195.5 202.5 174 183 109.5))
OXFORD
> (mean (append cambridge oxford))
181.41666666666666
> (exit)
sh-4.2$ exit
It should be possible for demonstration purposes, though
I have not attempted this, with a 2nd user to run xlispstat
in WeirdX, on which see this earlier Post.
sh-4.2$ ./xlispstat
XLISP-PLUS version 3.04
Portions Copyright (c) 1988, by David Betz.
Modified by Thomas Almy and others.
XLISP-STAT Release 3.52.20 (Beta).
Copyright (c) 1989-1999, by Luke Tierney.
> (def cambridge (list 188.5 183 194.5 185 214 203.5 186 178.5 109))
CAMBRIDGE
> (def oxford (list 186 184.5 204 184.5 195.5 202.5 174 183 109.5))
OXFORD
> (mean (append cambridge oxford))
181.41666666666666
> (exit)
sh-4.2$ exit
It should be possible for demonstration purposes, though
I have not attempted this, with a 2nd user to run xlispstat
in WeirdX, on which see this earlier Post.
Plan 9 from Bell Labs included Ghostscript version 8.53, which
has among other available devices, epswrite, jpeg and ppm, so
one should be able to utilise also grap and then pic to generate
histograms on that OS.
has among other available devices, epswrite, jpeg and ppm, so
one should be able to utilise also grap and then pic to generate
histograms on that OS.
NumPy and other projects have pledged to drop support for Python 2.7 in 2020.
To run the Tcl code you'll need to install this download.
http://slackbuilds.org/repository/14.1/libraries/tcllib/
tcllib-1.17.tar.gz
The newer tcllib-1.18 might work but I haven't tested
an installation on Slackware-14.0.
http://slackbuilds.org/repository/14.1/libraries/tcllib/
tcllib-1.17.tar.gz
The newer tcllib-1.18 might work but I haven't tested
an installation on Slackware-14.0.