Skip to content

Instantly share code, notes, and snippets.

@ylelkes
Created January 15, 2020 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ylelkes/fe2c786015a773638eec2f40caef3393 to your computer and use it in GitHub Desktop.
Save ylelkes/fe2c786015a773638eec2f40caef3393 to your computer and use it in GitHub Desktop.
zero1 <- function(x, minx=NA, maxx=NA){
res <- NA
if(is.na(minx)) res <- (x - min(x,na.rm=T))/(max(x,na.rm=T) -min(x,na.rm=T))
if(!is.na(minx)) res <- (x - minx)/(maxx -minx)
res
}
@ylelkes
Copy link
Author

ylelkes commented Jan 15, 2020

Recodes to lie between 0 and 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment