The concstats_shares
function is a helper function making it easier
to convert numeric variable into individual shares. This might be convenient
for larger vectors.
Arguments
- x
A non-negative numeric vector.
- na.rm
A logical vector that indicates whether
NA
values should be excluded or not. Must be eitherTRUE
orFALSE
. The default isTRUE
. If set toFALSE
the computation yieldsNA
ifNA
values are present.- digits
Numeric. A non-null value for digits specifies the minimum number of significant digits to be rounded in values. The default is
NULL
and will use base R print option.
Details
concstats_shares
is a helper function. The user can manually
convert or provide numerical vectors of shares or use
constats_shares
.
Examples
# a vector of loans (without special characters, e.g. currency symbols)
x <- c(538572286.08, 481096.77, 161914143.03, 128796268.59, 69055940.72)
concstats_shares(x, digits = 5)
#> [1] 0.59920 0.00054 0.18014 0.14329 0.07683
# a vector with NA values
x2 <- c(538572286.08, 481096.77, 161914143.03, 128796268.59, 69055940.72, NA)
concstats_shares(x2, na.rm = FALSE, digits = 5)
#> [1] NA