1
0

initial import of material for public archive into git

We're creating a fresh archive because the history for our old chapter includes
API keys, data files, and other material we can't share.
This commit is contained in:
2018-01-21 17:15:51 -08:00
commit dd420c77de
41 changed files with 7069 additions and 0 deletions

13
code/prediction/utils.R Normal file
View File

@@ -0,0 +1,13 @@
# Use this to check for underpopulated cells
gen.counts <- function(df, c.var){
tapply(df[,"eid"], c.var, function(x) length(unique(x)))
}
# use this to remove underpopulated cells
restrict <- function(df, c.var, c.min){
var.counts <- gen.counts(df, c.var)
out.df <- df[c.var %in% names(var.counts[var.counts >
c.min]),]
return(out.df)
}