Contributing to the R Extensions documentation
On Wed, 2003-11-05 at 12:06, Prof Brian Ripley wrote:
A list is just a vector of type VECSXP. There IS a section called `Handling lists'. I don't think the gap is in the `Writing R Extensions' document, maybe in your reading of it.
That section discusses reading lists, not making them. It also includes no explicit statement that the names of list items are in the R_NamesSymbol attribute, nor instructions on how to create the value that goes in that attribute (i.e., it should be a character vector and its elements made with mkChar()). (I'm also not sure how deep one needs to use PROTECT, though that's a more general issue.) There is no explicit statement that the elements of the list are arbitrary SEXP's. I also had the list[i] vs list[[i]] lurking in my mind, wondering how that mapped to the C level constructs. That is less central. I'm not saying the clues aren't there; after all, I did work it out, I think correctly. I am saying that certain information would be better stated explicitly rather than simply being open to inference from an example. And I am saying that an explicit example of constructing and returning a list (with named members) would be useful, since that's a common scenario.
On Wed, 5 Nov 2003, Ross Boylan wrote:
I thought there were some gaps in the R Extensions document; in particular, I was left wondering how to create a list. I think a paragraph on it would be useful. I would be happy to contribute the paragraph, but I'm not sure if there's interest or what the procedure is. Can anyone advise me? Though I was looking at the 1.7.0 version, I just checked 1.8.0 and the relevant section seems the same. My ulterior motive is to discover if my understanding of lists is actually correct :)
Ross Boylan wk: (415) 502-4031 530 Parnassus Avenue (Library) rm 115-4 ross at biostat.ucsf.edu Dept of Epidemiology and Biostatistics fax: (415) 476-9856 University of California, San Francisco San Francisco, CA 94143-0840 hm: (415) 550-1062