How to convert all the Latin numbers (such as "xxv," "xxxv," "iii," and "ii") into numerical values in text data with R?
I need to convert all the Latin numbers in a text data into numerical values. Is there any function in R can convert all the Latin numbers at once?
In addition, when I replace one by one, what if I have some words contains letters like "ii", "i"? For example, would the world "still" be changed into "st1ll"?
Get a vector of roman characters (note if you make this too large, the
gregexprwill throw an error, I didn't test to see what the limit is, however--it's somewhere between 1e2 and 1e3)Exclude "I" since that is more likely not to be a numeral, then create your pattern and treat it like any other string find/replace:
As a function: