Re: [Rd] .Call - applying setAttrib(x, R_DimSymbol, s) to a matrix being an element of a list

2005-03-17 Thread Oleg Sklyar
Thanks a lot for your comments. In fact I had an idea that maybe it is a pointer that is transferred after Simon's yesterday's commnent. So generally I should always allocVector for imgSize before passing it and just let the garbage collector to clean them afterwards if I understand right. Bes

Re: [Rd] .Call - applying setAttrib(x, R_DimSymbol, s) to a matrix being an element of a list

2005-03-17 Thread Simon Urbanek
Oleg, On Mar 16, 2005, at 8:34 PM, Oleg Sklyar wrote: Sorry, it is always a tradeoff - either to explain or put a relatively large code, Just posting all R related commands is sufficient ;) - in your case that would be the single imgSize alloc and the assignments- but the full code is fine, too.

Re: [Rd] .Call - applying setAttrib(x, R_DimSymbol, s) to a matrix being an element of a list

2005-03-17 Thread Prof Brian Ripley
On Thu, 17 Mar 2005, Oleg Sklyar wrote: Dear Simon, you gave us only a fragment of your code, so I can only guess what the problem is: What is imgSize? The behavior you describe seems as if you re-using the imgSize SEXP in all elements. AFAIR in your case setAttrib doesn't copy the value, so you

Re: [Rd] .Call - applying setAttrib(x, R_DimSymbol, s) to a matrix being an element of a list

2005-03-16 Thread Oleg Sklyar
Dear Simon, > you gave us only a fragment of your code, so I can only guess what the problem is: > What is imgSize? The behavior you describe seems as if you re-using the imgSize SEXP in all elements. > AFAIR in your case setAttrib doesn't copy the value, so you need to do so yourself (or alloc

Re: [Rd] .Call - applying setAttrib(x, R_DimSymbol, s) to a matrix being an element of a list

2005-03-16 Thread Simon Urbanek
Oleg, you gave us only a fragment of your code, so I can only guess what the problem is: On Mar 16, 2005, at 12:40 PM, Oleg Sklyar wrote: // converting element into a matrix setAttrib(element, R_DimSymbol, imgSize); What is imgSize? The behavior you describe seems as if you re-using the imgSize

[Rd] .Call - applying setAttrib(x, R_DimSymbol, s) to a matrix being an element of a list

2005-03-16 Thread Oleg Sklyar
Dear R developers, I am writing some C code that loads multiple images into a list of R matrices. The whole R object is created within the C code. To simplify coding, elements of the list are first created as vectors and then converted to corresponding matrices using setAttrib(x, R_DimSymbol, s)