[Rd] Rdconv --type=Ssgm drops singleton keywords (PR#9051)

From: <bill_at_insightful.com>
Date: Sat 01 Jul 2006 - 01:48:48 GMT


If an Rd file has only one keyword entry then the Splus sgm file made with Rdconv --type=SSgm has no keyword entries.

To reproduce:

   Use prompt() to make a skeleton help file

      R> f<-function(x)log(1+x)-log1p(x)
      R> prompt(f)
      Created file named 'f.Rd'.
      Edit the file and move it to the appropriate directory.
      R> q()
   It has 2 \keyword entries in it

% grep keyword f.Rd
\keyword{ ~kwd1 }% at least one, from doc/KEYWORDS \keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
   If you convert it to the Splus sgm format you get 2    <s-keyword> entries, in a <s-keywords> section:

% R CMD Rdconv --type=Ssgm f.Rd | grep 'keyword'

      <s-keywords>
      <s-keyword>~kwd1</s-keyword>
      <s-keyword>~kwd2</s-keyword>
      </s-keywords>

%

   That is good.

   If you remove one keyword entry from the Rd file so it has one left    then the sgm file has no <s-keyword> entries (and no <s-keywords>    section):

% grep -v '~kwd2' < f.Rd > f1kw.Rd
% grep keyword f1kw.Rd

      \keyword{ ~kwd1 }% at least one, from doc/KEYWORDS

% R CMD Rdconv --type=Ssgm f1kw.Rd | grep s-keyword
%

The fix:

   The problem is that the line

      if ($#keywords > 0) {
   should use >= 0 to tell if the list @keywords is non-empty.

--please do not edit the information below--

Version:
 platform = i686-pc-linux-gnu
 arch = i686
 os = linux-gnu
 system = i686, linux-gnu
 status = Under development (unstable)

 major = 2
 minor = 4.0
 year = 2006
 month = 06
 day = 29
 svn rev = 38459
 language = R
 version.string = R version 2.4.0 Under development (unstable) (2006-06-29 r38459)

Locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

Search Path:
 .GlobalEnv, package:methods, package:stats, package:graphics, package:grDevices, package:utils, package:datasets, Autoloads, package:base



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sat Jul 01 11:50:40 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 01 Jul 2006 - 06:25:55 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.