Question: In R, there is a great function `as.roman` in the very base setup:

```
as.roman(79)
# [1] LXXIX

```

Is there an inverse function that would convert roman numerals to numbers? 

(I know I can write it myself but I prefer to use already prepared or preferably standard functions, unfortunatelly cannot find one. Standard library or package function is a prefered solution)

Answer: 
`as.roman()` returns an object of class *roman*, so R recognizes it as such. You can directly turn it back into an Arabic numeral with `as.numeric()`. If you have a string that meets the criteria such that it could be a valid roman numeral, you can coerce it to a class roman object with `as.roman()`, and then coerce it into an Arabic numeral by composing the coercion functions. Consider: 

```
> as.roman(79)
[1] LXXIX
> x <- as.roman(79)
> x
[1] LXXIX
> str(x)
Class 'roman'  int 79
> as.roman("LXXIX")
[1] LXXIX
> as.numeric(as.roman("LXXIX"))
[1] 79

```
The `roman` numbers in R are, according to [the docs](http://stat.ethz.ch/R-manual/R-devel/library/utils/html/roman.html):

> 
> objects of class `"roman"` which are internally represented as integers, and have suitable methods for printing, formatting, subsetting, and coercion to `character`.
> 
> 
> 

You should therefore be able to get the integer value back using `as.integer()`:

```
as.integer(as.roman(79)+as.roman(12))

```