Skip to content

Commit

Permalink
Update random_functions
Browse files Browse the repository at this point in the history
Added the 'find midpoints' function
  • Loading branch information
nzcoops committed May 23, 2014
1 parent ce83d2e commit 9570b94
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions random_functions
Expand Up @@ -365,3 +365,10 @@ sum.gee <- function(mod, ci=0.95){
return(res)
}

# find midpoints

midpoints <- function(x, dp=2){
lower <- as.numeric(gsub(",.*","",gsub("\\(|\\[|\\)|\\]","", x)))
upper <- as.numeric(gsub(".*,","",gsub("\\(|\\[|\\)|\\]","", x)))
return(round(lower+(upper-lower)/2, dp))
}

0 comments on commit 9570b94

Please sign in to comment.