1

I have a dataframe that includes both pure fractions, integers with fractions and pure integers. Is there a base R function that can convert these string values to doubles.

For example:

df <- c("1 1/4", "1/2", "12 3/4", "1")
df2 <- function(df)
df2

>>(1.25,0.5,12.75,1.0)

Or do I need to write a function for this?

Mutuelinvestor
  • 3,384
  • 10
  • 44
  • 75

0 Answers0