Commit 0af2b005 authored by Weigert, Andreas's avatar Weigert, Andreas
Browse files

added normalization functions

parent b7154180
some_numbers <- c(200, 300, 400, 600, 1000)
norm_min_max <- function(v){
return((v-min(v))
/(max(v)-min(v)))
}
norm_min_max(some_numbers)
norm_z_score_sd <- function(v){
return((v-mean(v)) / sd(v))
}
norm_z_score_sd(some_numbers)
norm_z_score_mad <- function(v){
return(
(v-mean(v)) / (sum(abs(v-mean(v)))/length(v)))
}
norm_z_score_mad(some_numbers)
norm_dec <- function(v, j){
return(v/(10^j))
}
norm_dec(some_numbers, 3)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment