Skip to content

Instantly share code, notes, and snippets.

@dsparks
Created February 2, 2012 14:19
Show Gist options
  • Save dsparks/1723672 to your computer and use it in GitHub Desktop.
Save dsparks/1723672 to your computer and use it in GitHub Desktop.
Eddington Functions
Eddfinder <- function(v){
v=floor(v)
possibles=1:max(v)
count=function(w){length(v[v>w])}
which.max(lapply(possibles,count)<=possibles)
}
Eddington <- function(value,name){
temp=lapply(split(value,name),eddfinder)
unlist(temp)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment