powered by
Calculates percentage while handling division by zero and non-finite values.
safe_pct(numerator, denominator)
Numeric vector of percentages, with NA for invalid calculations.
Numeric vector for the numerator.
Numeric vector for the denominator.
safe_pct(c(10, 20, 30), c(100, 0, 200))
Run the code above in your browser using DataLab