Can I reasonably split these number strings?

Viewed 105

I have a bunch of strings like so:

x  <-  c("4/757.1%", "0/10%", "6/1060%", "0/0-%", "11/2055%")

They're fractions and the percent value of said fractions that somehow somewhere got mushed together. So the meaning of the first number in the example is 4 out of 7 is 57.1%. I can easily get the first number before the /(with, say, stringr::word(x, 1, sep = "/")) but the second number can be either one or two characters long so I'm having trouble thinking of a way to do it. I don't need the % value since that is easy enough to recalculate once I get the numbers.

Can anyone see a way of doing it?

3 Answers
Related