Skip to content

Sd2Rd Hangup

3 messages · Bartz, Kevin, Brian Ripley, Thomas Lumley

#
I've been converting a number of .sgml S-documentation filed to .Rd format
and a few persistent complications--all involving the documentation's
examples--have arisen every time I issue the standard R CMD check to prepare
my project for building. The impression I get is that the check script
simply tries to execute every R command in the included documentation's
example{ } sections. But since Sd2Rd essentially dumps an S-documentation
file's example contents into the new .Rd file, formatting problems crop up.
Correct me if I'm wrong, but Sd2Rd neither strips each example line's
opening greater-than (">") nor prunes the output. And then check barks at me
when R can't execute either of the ">"-padded example code or the actual
output, which I didn't even intend for it to try to interpret in the first
place. In the meantime, I've been using a Perl script that sifts through a
set of .Rd's and makes the proper connections, stripping all ">"s and
sticking "\dontrun"s around the output, but I was wondering if there's a
better or built-in way. Any advice?

Kevin
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Tue, 26 Jun 2001, Bartz, Kevin wrote:

            
Right.  There are no conventions for example sections in S's .d or .sgml
files.
If that works for you, that's the best I know of.  Most authors of S help
files do not include the > nor the output, so I see few problems in the
literally hundreds of such files I have ported.  When I do, I have to hand
edit, and for example the VR conversion scripts contain a set of patch
files to convert my co-author's conventions to R's.

But I am glad to know that someone is benefiting from the work I put in
writing the .sgml->.Rd converter.
#
On Tue, 26 Jun 2001, Bartz, Kevin wrote:

            
Indeed. And not just formatting problems.

S has never enforced a policy on whether examples should be executable
source or session transcripts (though the former seems much more common),
or on whether executable source actually has to run, so the format doesn't
let you specify, and it would be hard for a program to guess.

R does enforce a policy, as you have found. However, in converting other
people's S help files I have found editing the content of the examples to
be more work than editing the format -- S examples don't have to work, but
R examples do.


	-thomas

Thomas Lumley			Asst. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._