gah4 at u.washington.edu
2006-Aug-29 22:59 UTC
[Rd] list and pairlist in "Writing R Extensions" (PR#9185)
Full_Name: Glen Herrmannsfeldt Version: 2.2.1 OS: Linux Submission from: (NULL) (128.95.113.77) Following the discussion in "Writing R Extensions" in section 5.8.2, there is no indication that showArgs expects a pairlist() instead of a list(). I was trying .Call("showArgs",list(one=1,two=2,three=3)) for example, and getting many core dumps. It wasn't until reading "R Language Definition" that I found out about pairlist(), as needed. The final example: showArgs<-function(...) .Call("showArgs1",list(...)) looks like a list can be passed to showArgs, but in fact it is showArgs1, which doesn't seem to be documented at all! It could be that using pairlist() in 5.8.2 would fix the problem, but there should be a reference to the difference between list() and pairlist() thanks, -- glen
ripley at stats.ox.ac.uk
2006-Aug-30 06:45 UTC
[Rd] list and pairlist in "Writing R Extensions" (PR#9185)
It says clearly that showArgs is for use by .External, not .Call (it is introduced in a paragraph about the differences): @example showArgs <- function(...) .External("showArgs", ...) @end example and that is the main user error here. Pairlists are not needed when used as documented. On Wed, 30 Aug 2006, gah4 at u.washington.edu wrote:> Full_Name: Glen Herrmannsfeldt > Version: 2.2.1 > OS: Linux > Submission from: (NULL) (128.95.113.77) > > > Following the discussion in "Writing R Extensions" in section 5.8.2, there > is no indication that showArgs expects a pairlist() instead of a list(). > > I was trying > > .Call("showArgs",list(one=1,two=2,three=3)) > > for example, and getting many core dumps. > > It wasn't until reading "R Language Definition" that I found out > about pairlist(), as needed.> The final example: > > showArgs<-function(...) .Call("showArgs1",list(...)) > > looks like a list can be passed to showArgs, but in fact it is showArgs1, which > doesn't seem to be documented at all!It says this is an 'alternative style', not an example.> It could be that using pairlist() in 5.8.2 would fix the problem, > but there should be a reference to the difference between list() > and pairlist()-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Maybe Matching Threads
- alist()
- Different behavior of the "showArgs" example (R extension manual) between gcc and Visual C++ compiled code
- Sending "..." to a C external
- How to assign NULL value to pairlist element while keeping it a pairlist?
- How to assign NULL value to pairlist element while keeping it a pairlist?