[Rd] external pointers

2011-12-27 Thread Patrick Leyshock
I have an external pointer object that I'd like to pass from my R code to some C code. Per Section 5.13 of "Writing R Extensions", I've noted that "external pointers should only be used as part of an object with normal semantics, for example an attribute or an element of a list." So I've written

Re: [Rd] matching symbols to objects

2011-02-04 Thread Patrick Leyshock
; > Best, > Jeff > > On Fri, Feb 4, 2011 at 1:37 PM, Patrick Leyshock > wrote: > > Hello, > > > > I'm trying to access an object, given only its name as a symbol. I > cannot > > figure out how to proceed. Suppose I call substitute( ) on the > exp

Re: [Rd] matching symbols to objects

2011-02-04 Thread Patrick Leyshock
e) >> [1] "x" >> >> >> Best, >> Jeff >> >> On Fri, Feb 4, 2011 at 1:37 PM, Patrick Leyshock >> wrote: >> > Hello, >> > >> > I'm trying to access an object, given only its name as a symbol. I >> cann

[Rd] matching symbols to objects

2011-02-04 Thread Patrick Leyshock
Hello, I'm trying to access an object, given only its name as a symbol. I cannot figure out how to proceed. Suppose I call substitute( ) on the expression 'x + 2': > parse.tree <- substitute(x + 2); The constituents of parse.tree are of type symbol and numeric: > str(parse.tree[[1]]) symbol +

[Rd] R vs. C

2011-01-17 Thread Patrick Leyshock
A question, please about development of R packages: Are there any guidelines or best practices for deciding when and why to implement an operation in R, vs. implementing it in C? The "Writing R Extensions" recommends "working in interpreted R code . . . this is normally the best option." But we

[Rd] Performance monitoring tools

2010-11-17 Thread Patrick Leyshock
Hello, Are there any good tools available for monitoring the performance of R? I'm wanting to capture things such as time elapsed in evaluating an expression, memory usage over time (or operation), and so on. I could build my own but would like to follow established practice, if there is one. T

Re: [Rd] SEXPs and slots

2010-11-16 Thread Patrick Leyshock
Revisiting the output below: 1. Am I correct in thinking that the @XXX items are addresses? 2. What are the meanings of the gXcX items? 3. Does one ever see NAM[0]? Thanks, Patrick > .Internal(inspect(eg)) > @df70e48 25 S4SXP g0c0 [OBJ,NAM(2),gp=0x10,ATT] > ATTRIB: > @df70ef0 02 LISTSXP

Re: [Rd] SEXPs and slots

2010-11-15 Thread Patrick Leyshock
Thanks Martin and Hadley, this is very helpful. I should also add that I'm constantly reading the source code, but sometimes a response like this one can eliminate many, many hours of puzzlement. Much appreciated. Patrick On Mon, Nov 15, 2010 at 12:07 PM, Patrick Leyshock wrote: >

Re: [Rd] SEXPs and slots

2010-11-15 Thread Patrick Leyshock
/15/2010 07:45 AM, Patrick Leyshock wrote: > > Very helpful, thank you. > > > > A couple other questions, please: > > > > 1. I've got a function written in C, named "my_c_function". In my R > > code I call this function, passing to it an INTSXP

Re: [Rd] SEXPs and slots

2010-11-15 Thread Patrick Leyshock
or developing R? Nearly all the documents I've found are for programming R as a user, not as a developer. I have copies of the documentation, which are very helpful, but it'd be helpful to have additional resources to fill in their gaps. Thank you, Patrick On Fri, Nov 12, 2010 at 4:

[Rd] SEXPs and slots

2010-11-12 Thread Patrick Leyshock
Hello, I've created this class: setClass("example", representation ( size = "numeric", id= "character" ) ) Suppose I create a new instance of this class: > x <- new("example", 4, "id_value") This creates an S4 object with two slots. Am I correct in thinking that