Skip to content

Instantly share code, notes, and snippets.

@joethorley
Created January 4, 2017 23:29
Show Gist options
  • Save joethorley/9adddc7ad2e0aa1a38cefe5b726dc1fe to your computer and use it in GitHub Desktop.
Save joethorley/9adddc7ad2e0aa1a38cefe5b726dc1fe to your computer and use it in GitHub Desktop.
normalize
normalize <- function(x) {
if (min(x) > 0) {
if (max(x) < 1) {
x <- logit(x)
} else
x <- log(x)
}
x
}
logit <- function(x) {
log(x / (1 - x))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment