Re: [Rd] append/concatenate an element to a list in C-language

2007-10-19 Thread Peter Dalgaard
Robert Castelo wrote: > hi, > > thanks to all the replies, i think the discussion can be followed > throughout this message. > > >> You are returning an result in a function that returns void: the compiler >> will complain at you. >> > > apologies, indeed it should have been > > SEXP f(SEX

Re: [Rd] append/concatenate an element to a list in C-language

2007-10-19 Thread Robert Castelo
hi, thanks to all the replies, i think the discussion can be followed throughout this message. > You are returning an result in a function that returns void: the compiler > will complain at you. apologies, indeed it should have been SEXP f(SEXP list, SEXP element); > If you study the R Intern

Re: [Rd] append/concatenate an element to a list in C-language

2007-10-19 Thread Prof Brian Ripley
On Thu, 18 Oct 2007, Robert Castelo wrote: > dear people, > > i need to code a function in C working in R and receives two R SEXP > objects as parameters, where one is a list and another is a vector of > integers: > > void f(SEXP list, SEXP vector) { > > ... > > return list; > } You are returni

Re: [Rd] append/concatenate an element to a list in C-language

2007-10-18 Thread Tony Plate
This sounds like it could be dangerous, but if you're sure it's necessary and you know what you are doing, you could investigate whether the "pairlist" internal structure might enable you to do this (AFAIK, a "pairlist" is a traditional linked-list data structure). In general, pairlists seem t

Re: [Rd] append/concatenate an element to a list in C-language

2007-10-18 Thread Oleg Sklyar
Hi. I believe it is virtually impossible, maybe even not virtually: if you manage to do so somehow, please report it as a bug because such things must be impossible as they break the integrity of R and data. Forget about changing size in place: it is C and 'realloc' would be about the only way to

[Rd] append/concatenate an element to a list in C-language

2007-10-18 Thread Robert Castelo
dear people, i need to code a function in C working in R and receives two R SEXP objects as parameters, where one is a list and another is a vector of integers: void f(SEXP list, SEXP vector) { ... return list; } and it should return the given list with the integer vector concatenated at