[R] Output from examples in help files
John Fox
jfox at mcmaster.ca
Fri Mar 29 04:36:03 CET 2002
Dear Frank,
At 07:14 PM 3/28/2002 -0500, Frank E Harrell Jr wrote:
>I have a large number of troff help files which are automatically
>converted to .Rd files. Many of these have examples which contain the
>printed output of the examples. This makes example(functionname) not
>work. Is there a way to avoid removing all this output by delimiting it
>in some way such that the output will not appear in R-ex? Secondly, it
>would be nice if there was a place where output would be placed so that
>users could check results on different platforms or after upgrading a package.
I've noticed that in many cases output in help-file examples is simply
commented out, and I've followed this practice myself; for example:
\examples{
data(Kmenta)
summary(tsls(Q ~ P + D, ~ D + F + A, data=Kmenta)) # demand equation
## 2SLS Estimates
##
## Model Formula: Q ~ P + D
##
## Instruments: ~D + F + A
##
## Residuals:
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -3.43e+00 -1.24e+00 -1.89e-01 -2.49e-13 1.58e+00 2.49e+00
##
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 94.6333 7.92084 11.947 1.076e-09
## P -0.2436 0.09648 -2.524 2.183e-02
## D 0.3140 0.04694 6.689 3.811e-06
##
## Residual standard error: 1.9663 on 17 degrees of freedom
. . .
}
Of course, you'll probably have to add the #'s manually. (I agree that it
would be nice if output were handled explicitly in .Rd files.)
I hope that this helps,
John
-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-----------------------------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list