Description Usage Arguments Details Value Author(s) See Also Examples
Convert roman numerals to integers
1 | roman2int(roman)
|
roman |
character vector containing roman numerals |
This functon will convert roman numerals to integers without the upper bound imposed by R (3899), ignoring case.
A integer vector with the same length as roman
. Character
strings which are not valid roman numerals will be converted to NA
.
Gregory R. Warnes greg@warnes.net
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | roman2int( c('I', 'V', 'X', 'C', 'L', 'D', 'M' ) )
# works regardless of case
roman2int( 'MMXVI' )
roman2int( 'mmxvi' )
# works beyond R's limit of 3899
val.3899 <- 'MMMDCCCXCIX'
val.3900 <- 'MMMCM'
val.4000 <- 'MMMM'
as.numeric(as.roman( val.3899 ))
as.numeric(as.roman( val.3900 ))
as.numeric(as.roman( val.4000 ))
roman2int(val.3899)
roman2int(val.3900)
roman2int(val.4000)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.