[R-gregmisc-commits] r2046 - pkg/gtools/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed May 27 04:48:56 CEST 2015


Author: warnes
Date: 2015-05-27 04:48:54 +0200 (Wed, 27 May 2015)
New Revision: 2046

Added:
   pkg/gtools/man/roman2int.Rd
Log:
Add man page for roman2int().


Added: pkg/gtools/man/roman2int.Rd
===================================================================
--- pkg/gtools/man/roman2int.Rd	                        (rev 0)
+++ pkg/gtools/man/roman2int.Rd	2015-05-27 02:48:54 UTC (rev 2046)
@@ -0,0 +1,47 @@
+\name{roman2int}
+\alias{roman2int}
+\title{Convert Roman Numerals to Integers}
+\description{
+  Convert roman numerals to integers
+}
+\usage{
+roman2int(roman)
+}
+\arguments{
+  \item{roman}{character vector containing roman numerals}
+}
+\details{
+  This functon will convert roman numerals to integers without the upper bound
+  imposed by R (3899), ignoring case.
+}
+\value{
+  A integer vector with the same length as \code{roman}.  Character
+  strings which are not valid roman numerals will be converted to \code{NA}.
+}
+\author{
+  Gregory R. Warnes \email{greg at warnes.net}
+}
+\seealso{
+  \code{\link[utils]{as.roman}}
+}
+\examples{
+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)
+
+}
+\keyword{arith}



More information about the R-gregmisc-commits mailing list