[Roxygen-commits] r190 - in pkg/inst/doc: . pseudoprime/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Aug 26 20:20:21 CEST 2008


Author: pcd
Date: 2008-08-26 20:20:20 +0200 (Tue, 26 Aug 2008)
New Revision: 190

Modified:
   pkg/inst/doc/hello-roxygen.R
   pkg/inst/doc/pseudoprime/R/pseudoprime.R
   pkg/inst/doc/roxygen.Rnw
Log:
clarify fig 1/fig 2; TODO


Modified: pkg/inst/doc/hello-roxygen.R
===================================================================
--- pkg/inst/doc/hello-roxygen.R	2008-08-26 12:38:34 UTC (rev 189)
+++ pkg/inst/doc/hello-roxygen.R	2008-08-26 18:20:20 UTC (rev 190)
@@ -1,5 +1,4 @@
 #' A toy package to check Roxygen's sanity
-#'
 #' @name helloRoxygen-package
 #' @docType package
 NA

Modified: pkg/inst/doc/pseudoprime/R/pseudoprime.R
===================================================================
--- pkg/inst/doc/pseudoprime/R/pseudoprime.R	2008-08-26 12:38:34 UTC (rev 189)
+++ pkg/inst/doc/pseudoprime/R/pseudoprime.R	2008-08-26 18:20:20 UTC (rev 190)
@@ -5,13 +5,13 @@
 #' then \eqn{a} raised to the \eqn{n}th power is congruent to
 #' \eqn{a\ modulo\ n}{a modulo n}.
 #'
-#' @author Peter Danenberg \email{pcd@@roxygen.org}
 #' @param n the integer to test for primality
 #' @return Whether the integer passes the Fermat test
 #'   for a randomized \eqn{0 < a < n}
 #' @callGraphPrimitives
 #' @note \code{fermat.test} doesn't work for integers above
 #'   approximately fifteen because modulus loses precision.
+#' @author Peter Danenberg \email{pcd@@roxygen.org}
 fermat.test <- function(n) {
   a <- floor(runif(1, min=1, max=n))
   a ^ n %% n == a
@@ -25,7 +25,6 @@
 #' such tests, the chances are better than 3 out of 4 that
 #' \eqn{n} is prime.
 #'
-#' @author Peter Danenberg \email{pcd@@roxygen.org}
 #' @param n the integer to test for pseudoprimality.
 #' @param times the number of Fermat tests to perform
 #' @return Whether the number is pseudoprime
@@ -34,9 +33,9 @@
 #' @references Abelson, Hal; Jerry Sussman, and Julie Sussman.
 #'   Structure and Interpretation of Computer Programs.
 #'   Cambridge: MIT Press, 1984.
+#' @author Peter Danenberg \email{pcd@@roxygen.org}
 #' @examples
-#' # TRUE most of the time
-#' is.pseudoprime(13, 4)
+#' is.pseudoprime(13, 4)  # TRUE most of the time
 is.pseudoprime <- function(n, times) {
   if (times == 0) TRUE
   else if (fermat.test(n)) is.pseudoprime(n, times - 1)

Modified: pkg/inst/doc/roxygen.Rnw
===================================================================
--- pkg/inst/doc/roxygen.Rnw	2008-08-26 12:38:34 UTC (rev 189)
+++ pkg/inst/doc/roxygen.Rnw	2008-08-26 18:20:20 UTC (rev 190)
@@ -4,11 +4,13 @@
 \usepackage{url}
 \usepackage{graphicx}
 \usepackage{grffile}
+\usepackage{afterpage}
+\usepackage{float}
 %% \VignetteIndexEntry{Roxygen Vignette}
 \newcommand{\Roxygen}{\texttt{Roxygen}}
 %% path, filename, caption, label
 \newcommand{\listing}[4]{        %
-  \begin{figure}[h]              %
+  \begin{figure}[ht]             %
     \centering                   %
     \VerbatimInput[numbers=left, %
       frame=single,              %
@@ -33,7 +35,7 @@
   \end{itemize}
 \end{abstract}
 \tableofcontents
-\section{Minimal Example: ``Hello Roxygen''}
+\section{Minimal Example: ``Hello, Roxygen!''}
 
 \listing{hello-roxygen.R}
         {hello-roxygen.R}
@@ -82,16 +84,17 @@
 \texttt{NOOP} (null statement) to stand in for such cases.
 
 The first sentence of any \Roxygen{} block briefly describes its
-object; and may be followed directly by a \Roxygen{} tag (as in figure
-\ref{hello-roxygen}) or a more detailed description (as in figure
-\ref{pseudoprime-package}). The detailed description begins after the
-intervening blank line (line 2) and continues until the first
-\Roxygen{} tag (line 19).
+object; and may be followed directly by a \Roxygen{} tag
+(fig. \ref{hello-roxygen}, line 2) or a more detailed description
+(fig.  \ref{pseudoprime-package}, line 3). The detailed description
+begins after the intervening blank line, and continues until the first
+\Roxygen{} tag (fig. \ref{pseudoprime-package}, line 19).
 
 Each \Roxygen{} tag begins with an ampersand, like \texttt{@name},
 \texttt{@author}, etc.; which means, incidentally, that all real
 ampersands have to be escaped with a double-ampersand, as in
-\verb=\email{pcd@@wikitex.org}= (line 23).
+\verb=\email{pcd@@roxygen.org}= (fig. \ref{pseudoprime-package}, line
+23).
 
 Furthermore, although \Roxygen{} tags replace many of the structural
 Rd elements such as \verb=\title=, \verb=\keyword=, etc.; many of the
@@ -106,6 +109,12 @@
         {Roxygen example \texttt{pseudoprime.R}}
         {pseudoprime}
 
+TODO: split \texttt{pseudoprime.R} into \texttt{fermat.R} and
+\texttt{pseudoprime.R}; talk about \texttt{@param}, \texttt{@return},
+\texttt{@callGraphPrimitives} in the context of \texttt{fermat.R},
+and \texttt{@include} and \texttt{@export} in the context of
+\texttt{pseudoprime.R}.
+
 <<>>=
 roxygenize('pseudoprime',
            roxygen.dir='pseudoprime',
@@ -114,11 +123,10 @@
 
 @
 
-
-\begin{figure}
-\centering
-\includegraphics{pseudoprime/inst/doc/fermat.test-callgraph}
-\caption{\texttt{fermat.test} call graph with primitives}
-\label{fermat-test}
+\begin{figure}[ht]
+  \centering
+  \includegraphics{pseudoprime/inst/doc/fermat.test-callgraph}
+  \caption{\texttt{fermat.test} call graph with primitives}
+  \label{fermat-test}
 \end{figure}
 \end{document}



More information about the Roxygen-commits mailing list