Created
January 15, 2020 00:04
-
-
Save ylelkes/fe2c786015a773638eec2f40caef3393 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Recodes to lie between 0 and 1.