ben best <bbest@nceas.ucsb.edu>
2014-04-15 in santa barbara, ca
pristine?
“a healthy ocean sustainably delivers a range of benefits to people now and in the future”
python setup.py install
cd example
flow
Running flow [rootdir=~/linear-flow-master/example] depth=0 nproc=1
Running package with default style [~/linear-flow-master/example]
Running python script import.py
Generating some dummy data in data.csv...
Running R script model.R
Running R script model.r
task: calculate the batting average (AVG): number of base hits (H) divided by the total number of at bats (AB) using the Lahman baseball database. limit to Babe Ruth and Jackie Robinson.
setup
library(Lahman)
library(dplyr)
library(RSQLite)
nameFirst nameLast avg
Babe Ruth 0.323
Jackie Robinson 0.308
tbl(lahman_sqlite(), sql(
"SELECT nameFirst, nameLast,
ROUND(AVG(H/(AB*1.0)), 3) AS avg
FROM Batting
JOIN Master USING (playerID)
WHERE AB > 0 AND ((
(nameFirst = 'Babe' AND
nameLast = 'Ruth') OR
(nameFirst = 'Jackie' AND
nameLast = 'Robinson'))
GROUP BY nameFirst, nameLast
ORDER BY avg DESC")))
%.%): grammar of data manipulationBatting %.%
merge(Master, by='playerID') %.%
filter(
AB > 0 &
(nameFirst=='Babe' &
nameLast =='Ruth') |
(nameFirst=='Jackie' &
nameLast =='Robinson')) %.%
group_by(nameFirst, nameLast) %.%
summarise(avg = round(mean(H/AB), 3)) %.%
arrange(desc(avg))
| direction | org web | user web | user local |
|---|---|---|---|
github.com/[org]/[repo] |
github.com/[user]/[repo] |
~/github/[repo] |
|
| -> (1x) | -> fork | -> clone | |
| <- | merge {admin} <- | <- pull request | <- push, <-> commit |
where:
[org] is an organization (eg ohi-science)[repo] is a repository in the orgranization (eg ohiprep)[user] is your github username (eg bbest)