scale_by_sum: Scale values of a vector so that the result sums to 1

View source: R/sequence_characteristics.R

scale_by_sumR Documentation

Scale values of a vector so that the result sums to 1

Description

Scale values of a vector so that the result sums to 1

Usage

scale_by_sum(x)

Arguments

x

A numeric vector

See Also

scale_to_reference_fun

Examples

x <- c(1:6, 8)

# Equivalent but more efficient than `scale_to_reference_fun`
scale_by_sum(x)
scale_to_reference_fun(x, 1, fun = sum)


DrylandEcology/rSW2utils documentation built on Dec. 9, 2023, 10:44 p.m.