[Roxygen-commits] r83 - in pkg: R sandbox

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jul 24 20:17:53 CEST 2008


Author: pcd
Date: 2008-07-24 20:17:53 +0200 (Thu, 24 Jul 2008)
New Revision: 83

Added:
   pkg/sandbox/example-Rd-nlm-test.R
Modified:
   pkg/R/Rd.R
Log:
source for @example; explanation of stdout


Modified: pkg/R/Rd.R
===================================================================
--- pkg/R/Rd.R	2008-07-24 18:16:01 UTC (rev 82)
+++ pkg/R/Rd.R	2008-07-24 18:17:53 UTC (rev 83)
@@ -12,6 +12,7 @@
 #' Contains the member function \code{parse} which parses the result
 #' of \code{parse.files}.
 #'
+#' @param stdout whether to cat to standard out (e.g. for testing)
 #' @return Rd roclet
 make.Rd.roclet <- function(stdout=FALSE) {
   #' Translate a key and expressions into an Rd expression;

Added: pkg/sandbox/example-Rd-nlm-test.R
===================================================================
--- pkg/sandbox/example-Rd-nlm-test.R	                        (rev 0)
+++ pkg/sandbox/example-Rd-nlm-test.R	2008-07-24 18:17:53 UTC (rev 83)
@@ -0,0 +1,17 @@
+f <- function(x) sum((x-1:length(x))^2)
+nlm(f, c(10,10))
+nlm(f, c(10,10), print.level = 2)
+utils::str(nlm(f, c(5), hessian = TRUE))
+
+f <- function(x, a) sum((x-a)^2)
+nlm(f, c(10,10), a=c(3,5))
+f <- function(x, a)
+{
+    res <- sum((x-a)^2)
+    attr(res, "gradient") <- 2*(x-a)
+    res
+}
+nlm(f, c(10,10), a=c(3,5))
+
+## more examples, including the use of derivatives.
+demo(nlm)



More information about the Roxygen-commits mailing list