Why not use 1/x directly in functions?

magrittr's pipeable operator replacements

operator: x^y
functional alternative: x %>% raise_to_power(y)

# Define a harmonic acres to hectares function
harmonic_acres_to_hectares <- function(acres) {
  acres %>% 
    # Get the reciprocal
    raise_to_power(-1) %>%
    # Convert acres to hectares
    acres_to_hectares() %>% 
    # Get the reciprocal again

I am curious why don't use 1/x directly?

The reason is for the same reason that the pipe is motivated, which is readability

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.