Re: [Rd] Calling Rscript from Makevars

2011-05-26 Thread Sean Robert McGuffee
Thanks for the help! On 5/23/11 8:58 PM, "Simon Urbanek" wrote: > Sean, > > On May 23, 2011, at 2:03 PM, Sean Robert McGuffee wrote: > >> >> On 5/23/11 1:30 PM, "Simon Urbanek" wrote: >> >>> >>> On May 23, 2011, at 12:56 PM, Sean Robert McGuffee wrote: >>> I'm not sure what you mean

[Rd] Statistical mode

2011-05-26 Thread Arni Magnusson
One descriptive statistic that is conspicuously missing from core R is the statistical mode - the most frequent value in a discrete distribution. I would like to propose adding the attached 'statmode' (or a similar function) to the 'stats' package. Currently, it can be quite cumbersome to cal

[Rd] Reference Classes: strange behavior when trying to change class def in the same R session

2011-05-26 Thread Janko Thyson
Dear list, I'm getting some strange behavior with Reference Classes every once in a while and I can't really put my finger on the cause. It'd be great if someone using Reference Classes could check if he/she experiences similar problems: The thing is that when I alter the definition of a Ref

[Rd] Reference Classes: getter and setter functions/methods and possible shortcuts

2011-05-26 Thread Janko Thyson
Hi everyone, just wanted to ask what's the smartest/recommended way of defining getter and setter function *shortcuts* (i.e. something like "[", "[<-") for Reference Class objects? Or is it desired to not use this stuff, but define methods like 'obj$getSubset(row=1:3, col=1)' and 'obj$setSubse

Re: [Rd] Is it possible to define a function's arguments via a wildcard in 'substitute()'?

2011-05-26 Thread Janko Thyson
Thanks a lot Hadley, think I got it figured out now. expr <- substitute( myFoo <- function( myArg=0 ){ print("hello world!") eval(BODY) if("..." %in% names(formals(as.character(sys.call())[1]))){ print(data.frame(...)) } else {

Re: [Rd] Is it possible to define a function's arguments via a wildcard in 'substitute()'?

2011-05-26 Thread Hadley Wickham
I think for the case where you want to built up a call from a function name + list of arguments, it's best to use call or as.call: call("f", a = 1, b = 2, c = 3) or if you already have the list: l <- list(as.name("f"), a = 1, b = 2, c = 3) as.call(l) Hadley On Thu, May 26, 2011 at 10:15 AM, Jan

Re: [Rd] serialization of external pointers

2011-05-26 Thread Romain Francois
Le 26/05/11 17:04, Simon Urbanek a écrit : On May 26, 2011, at 10:40 AM, Romain Francois wrote: Hello, I'm looking for examples of how to handle serialization of external pointers. We use external pointers intensively in Rcpp for modules and one popular request is to have persistence. And

[Rd] Is it possible to define a function's arguments via a wildcard in 'substitute()'?

2011-05-26 Thread Janko Thyson
Dear List, just out of pure curiosity: is it possible to define a function via 'substitute()' such that the function's formal arguments are specified by a "wildcard" that is substituted when the expression is evaluated? Simple example: x.args <- formals("data.frame") x.body <- expression(

Re: [Rd] serialization of external pointers

2011-05-26 Thread Simon Urbanek
On May 26, 2011, at 10:40 AM, Romain Francois wrote: > Hello, > > I'm looking for examples of how to handle serialization of external pointers. > > We use external pointers intensively in Rcpp for modules and one popular > request is to have persistence. And I guess we need to be able to > se