Utility for normalizing data without unit norms.
check_unit_norm(x, warnings = TRUE)
observations claimed to have unit norms. Either a matrix of size c(nx, p) or a vector of length p.
c(nx, p)
p
whether to show warnings if the normalization of x happened.
x
A curated version of x with unit-norm observations and possible zeros excluded.
# NOT RUN { check_unit_norm(c(sqrt(2), sqrt(2), 0) / 2) check_unit_norm(1:3, warnings = FALSE) check_unit_norm(rbind(c(0, 0, 0), c(0, 0, 1), 1:3, c(NA, 0, 1)), warnings = FALSE) # }
Run the code above in your browser using DataLab