[Rd] API documentation for R

2024-06-26 Thread Ivan Krylov via R-devel
В Thu, 25 Apr 2024 10:10:44 -0700
Kevin Ushey  пишет:

> I'm guessing the most welcome kinds of contributions would be
> documentation? IMHO, "documenting an API" and "describing how an API
> can be used" are somewhat separate endeavors. I believe R-exts does an
> excellent job of the latter, but may not be the right vehicle for the
> former. To that end, I believe it would be helpful to have some
> structured API documentation as a separate R-api document.

Now that we have a machine-readable list of APIs in the form of
system.file('wre.txt', package = 'tools') (which is not yet an API
itself, but I trust we'll be able to adapt to ongoing changes), it's
possible to work on such an R-api document.

I've put a proof of concept that checks its Texinfo indices against the
list of @apifun entries in wre.txt at 
with a rendered version at . I've
tried to address Agner's concerns [*] about R_NO_REMAP by showing the
declarations available with or without this preprocessor symbol
defined.

34 vaguely documented entry points out of 538 lines in wre.txt is
obviously not enough, but I'm curious whether this is the right
direction. Should we keep to a strict structure, like in Rd files, with
a table for every argument and the return value? Can we group functions
together, or should there be a separate @node for every function and
variable? Is Rd (and Henrik's earlier work [**]) a better format than
Texinfo for a searchable C API reference?

-- 
Best regards,
Ivan

[*] https://stat.ethz.ch/pipermail/r-package-devel/2024q2/010913.html

[**] https://github.com/HenrikBengtsson/RNativeAPI

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] rbind() on zero row matrices is inconsistent

2024-06-26 Thread Duncan Murdoch

The help for cbind() and rbind() says

"For cbind (rbind), vectors of zero length (including NULL) are ignored 
unless the result would have zero rows (columns), for S compatibility. 
(Zero-extent matrices do not occur in S3 and are not ignored in R.)"


This leads to an inconsistency.


  M <- matrix(NA, 0, 0)  # Make a 0x0 matrix
  N <- matrix(NA, 0, 1)  # Make a 0x1 matrix


  dim(rbind(M, NULL, NULL)) # adds 2 rows to M
  #> [1] 2 0
  dim(rbind(N, NULL, NULL)) # leaves N unchanged
  #> [1] 0 1


You get an extra row on the 0x0 matrix for each NULL value that is bound 
to it, but the 0xn matrix is unchanged for n > 0.


Clearly from the help this is intentional, but is it desirable? 
Wouldn't it make more sense for NULL to be ignored by rbind() and cbind()?


Duncan Murdoch

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] rbind() on zero row matrices is inconsistent

2024-06-26 Thread Kurt Hornik
> Duncan Murdoch writes:

> The help for cbind() and rbind() says
> "For cbind (rbind), vectors of zero length (including NULL) are ignored 
> unless the result would have zero rows (columns), for S compatibility. 
> (Zero-extent matrices do not occur in S3 and are not ignored in R.)"

> This leads to an inconsistency.


>M <- matrix(NA, 0, 0)  # Make a 0x0 matrix
>N <- matrix(NA, 0, 1)  # Make a 0x1 matrix


>dim(rbind(M, NULL, NULL)) # adds 2 rows to M
>#> [1] 2 0
>dim(rbind(N, NULL, NULL)) # leaves N unchanged
>#> [1] 0 1


> You get an extra row on the 0x0 matrix for each NULL value that is bound 
> to it, but the 0xn matrix is unchanged for n > 0.

> Clearly from the help this is intentional, but is it desirable?
> Wouldn't it make more sense for NULL to be ignored by rbind() and
> cbind()?

I would agree :-)

Best
-k

> Duncan Murdoch

> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Fixing a CRAN note

2024-06-26 Thread Therneau, Terry M., Ph.D. via R-devel
I am trying to clear up all the "NOTE"s before a CRAN submission, but am a bit 
confused 
about this one.   What is it complaining about -- that it doesn't like my name?

...
* checking for file ‘deming/DESCRIPTION’ ... OK
* this is package ‘deming’ version ‘1.4-1’
* checking CRAN incoming feasibility ... [7s/18s] NOTE
Maintainer: ‘Terry Therneau ’

Found the following \keyword or \concept entries
which likely give several index terms:
   File ‘deming.Rd’:
     \keyword{models, regression}
* checking package namespace information ... OK
* checking package dependencies ... OK
...

-- 
Terry M Therneau, PhD
Department of Quantitative Health Sciences
Mayo Clinic
thern...@mayo.edu

"TERR-ree THUR-noh"

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Fixing a CRAN note

2024-06-26 Thread Kurt Hornik
> Therneau, Terry M , Ph D via R-devel writes:

> I am trying to clear up all the "NOTE"s before a CRAN submission, but am a 
> bit confused 
> about this one.   What is it complaining about -- that it doesn't like my 
> name?

> ...
> * checking for file ‘deming/DESCRIPTION’ ... OK
> * this is package ‘deming’ version ‘1.4-1’
> * checking CRAN incoming feasibility ... [7s/18s] NOTE
> Maintainer: ‘Terry Therneau ’

> Found the following \keyword or \concept entries
> which likely give several index terms:
>    File ‘deming.Rd’:
>      \keyword{models, regression}

Use

  \keyword{models}
  \keyword{regression}

Hth
-k

> * checking package namespace information ... OK
> * checking package dependencies ... OK
> ...

> -- 
> Terry M Therneau, PhD
> Department of Quantitative Health Sciences
> Mayo Clinic
> thern...@mayo.edu

> "TERR-ree THUR-noh"

>   [[alternative HTML version deleted]]

> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Fixing a CRAN note

2024-06-26 Thread Ivan Krylov via R-devel
26 июня 2024 г. 16:42:39 GMT+03:00, "Therneau, Terry M., Ph.D. via R-devel" 
 пишет:
>What is it complaining about -- that it doesn't like my name?

>* checking CRAN incoming feasibility ... [7s/18s] NOTE
>Maintainer: ‘Terry Therneau ’
>
>Found the following \keyword or \concept entries
>which likely give several index terms:
>   File ‘deming.Rd’:
>     \keyword{models, regression}
I think that the check points out that in order to specify multiple keywords, 
you need to use \keyword{models} and \keyword{regression} separately, not 
\keyword{models, regression} in one Rd command.

-- 
Best regards,
Ivan

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel