The as_decimal
function parses a string and evaluates the result to
return a numeric approximation.
as_decimal(fraction)
fraction | The input fraction, already parsed, or a string to
be parsed using |
---|
A numeric (possible approximation) of the fraction converted to a numeric value.
# String as input as_decimal("2 3/8")#> [1] 2.375# Parsed fraction as input x <- as_improper("-1 1/3") as_decimal(x)#> [1] -1.333333