powered by
Scale a numeric vector by the sum of its elements
normalize(x)
A numeric vector
x / sum(x)
# NOT RUN { x <- c(1,1,1,1) normalize(x) # }
Run the code above in your browser using DataLab