[Rd] Creating a VECSXP when n is unknown(using Linked list)

2009-03-31 Thread Saptarshi Guha
Hello, I need to create a VECSXP(A) each element of which is a 2-element VECSXP. Since I dont know how many elements there will be i create a linked list of 2-element VECSXP (see code at end) Once I know the number of elements, i then go ahead allocVector A and then SET_VECTOR_ELEMENT the elements

[Rd] R in standalone application

2009-03-31 Thread Eric
I am trying to build a C application where I need to compute some statistics to take decisions about the direction to give to a user, knowing his/her habits. Because I used R back at school, I thought I can use some of his functions in my application, as a shared library. I reviewed the "Rinte

Re: [Rd] Compile R Library with GCC garbage collection on or supported

2009-03-31 Thread Simon Urbanek
On Mar 31, 2009, at 3:25 PM, David Zwerdling wrote: Hi All, I'm not that familiar with configure or make (more of a Java developer as a dayjob) but I was wondering what the process would be to add the flag -fobjc-gcc in the compilation of the R library for use in an Objective-C application

[Rd] 'sep' argument in reshape()

2009-03-31 Thread Stephen Weigand
I wonder if the 'sep' argument in reshape() is being ignored unintentionally: ## From example(reshape) df <- data.frame(id=rep(1:4,rep(2,4)), visit=I(rep(c("Before","After"),4)), x=rnorm(4), y=runif(4)) reshape(df, timevar="visit", idvar="id", direction="wide"

Re: [Rd] duplicated.data.frame {was "[R] which rows are duplicates?"}

2009-03-31 Thread Wacek Kusnierczyk
Martin Maechler wrote: > > >> > >> and then be helpful to the R community and send a bug report > >> *with* a patch if {as in this case} you are able to... > >> > >> Well, that' no longer needed here, > >> I'll fix that easily myself. > >> > > WK> but i *have* sen

Re: [Rd] what is the preferred method to create a package local variable?

2009-03-31 Thread Philippe Grosjean
The best way is to have those variable hidden in the package's workspace, as explained by Roger Peng. However, if you like to use a mechanism managing an environment specifically dedicated to temporary variables very easily, look at assignTemp() and getTemp() from svMisc package. The advantage

Re: [Rd] what is the preferred method to create a package local variable?

2009-03-31 Thread Roger Peng
I usually use environments for this. So, in one of the R files for the package, just do .localstuff <- new.env() Then, in functions you can do things like .localstuff$bbg.db.conn <- dbConnect(...) -roger On Tue, Mar 31, 2009 at 11:45 AM, Whit Armstrong wrote: > for the moment, I'm using: > >

[Rd] Compile R Library with GCC garbage collection on or supported

2009-03-31 Thread David Zwerdling
Hi All, I'm not that familiar with configure or make (more of a Java developer as a dayjob) but I was wondering what the process would be to add the flag -fobjc-gcc in the compilation of the R library for use in an Objective-C application. Can one simply drop this into the configure file somewhere

Re: [Rd] as.data.frame peculiarities

2009-03-31 Thread Wacek Kusnierczyk
Stavros Macrakis wrote: > The documentation of as.data.frame is not explicit about how it generates > column names for the simple vector case, but it seems to use the character > form of the quoted argument, e.g. > > names(as.data.frame(1:3)) > [1] "1:3" > > But there is a strange case: > > names(a

Re: [Rd] external equiv to R_serialize()?

2009-03-31 Thread Joe Conway
Prof Brian Ripley wrote: On Mon, 30 Mar 2009, Joe Conway wrote: I'm trying to efficiently allow conversion of R objects to PostgreSQL bytea (raw binary) datatype within PL/R for persistent storage in Postgres tables. I have found R_serialize() which looks like what I need, -- e.g. R_serialize

Re: [Rd] what is the preferred method to create a package local variable?

2009-03-31 Thread Martin Morgan
Stavros Macrakis wrote: On Tue, Mar 31, 2009 at 12:41 PM, Martin Morgan > wrote: I don't konw about preferred, but one method is pkgVars <- local({ x <- NULL list(getX=function() x, setX=function(value) x <<- value) }) with use > p

Re: [Rd] Wishlist: optional svn-revision number tag in package DESCRIPTION file

2009-03-31 Thread Dirk Eddelbuettel
On 31 March 2009 at 12:58, Duncan Murdoch wrote: | On 3/31/2009 10:41 AM, Peter Ruckdeschel wrote: | > Could we have one (or maybe more) standardized optional tag(s) | > for package DESCRIPTION files to cover svn revision info? | > This would be very useful for bug reporting... Indeed. I am doing

Re: [Rd] what is the preferred method to create a package local variable?

2009-03-31 Thread Stavros Macrakis
On Tue, Mar 31, 2009 at 12:41 PM, Martin Morgan wrote: > I don't konw about preferred, but one method is > > pkgVars <- local({ >x <- NULL >list(getX=function() x, setX=function(value) x <<- value) > }) > > with use > > > pkgVars$getX() > ... > This introduces a different programming para

Re: [Rd] what is the preferred method to create a package local variable?

2009-03-31 Thread Gabor Grothendieck
Look at the zzz.R file in the lattice package and the .LatticeEnv variable in particular. Also, when running lattice try this and look for .LatticeEnv in the output: ls(asNamespace("lattice"), all = TRUE) On Tue, Mar 31, 2009 at 11:45 AM, Whit Armstrong wrote: > for the moment, I'm using: > > .

Re: [Rd] installing RMySQL (PR#13633)

2009-03-31 Thread Uwe Ligges
ankheedu...@gmail.com wrote: Full_Name: Ankhee Dutta Version: 2.3 1. Please read the FAQs on how to report bugs: Always use a recent version of R, your version has been released roughly 36 months ago! R-2.9.0 is to be released in April. Hence please check bugs with the current pre-release

Re: [Rd] Wishlist: optional svn-revision number tag in package DESCRIPTION file

2009-03-31 Thread Duncan Murdoch
On 3/31/2009 10:41 AM, Peter Ruckdeschel wrote: Hi, just a little wish : Could we have one (or maybe more) standardized optional tag(s) for package DESCRIPTION files to cover svn revision info? This would be very useful for bug reporting... I know that any developer is already free to append c

Re: [Rd] what is the preferred method to create a package local variable?

2009-03-31 Thread hadley wickham
For saving the previous plot in ggplot2, I use the following: .plot_store <- function() { .last_plot <- NULL list( get = function() .last_plot, set = function(value) .last_plot <<- value ) } .store <- .plot_store() set_last_plot <- function(value) .store$set(value) last_plot <- fun

Re: [Rd] what is the preferred method to create a package local variable?

2009-03-31 Thread Martin Morgan
Hi Whit -- Whit Armstrong writes: > for the moment, I'm using: > > .onAttach <- function(libname, pkgname) { > .bbg.db.conn <<- dbConnect(dbDriver("PostgreSQL"), user="blah","blah") > } > > .onUnload <- function(libpath) { > dbDisconnect(.bbg.db.conn) > } > > > which results in a hidden

Re: [Rd] Wishlist: optional svn-revision number tag in package DESCRIPTION file

2009-03-31 Thread Gabor Grothendieck
We need to make sure we understand the implications for packages developed under the other major version control systems like git, bzr and hg. On Tue, Mar 31, 2009 at 10:41 AM, Peter Ruckdeschel wrote: > Hi, > > just a little wish : > > Could we have one (or maybe more) standardized optional tag(

[Rd] Wishlist: optional svn-revision number tag in package DESCRIPTION file

2009-03-31 Thread Peter Ruckdeschel
Hi, just a little wish : Could we have one (or maybe more) standardized optional tag(s) for package DESCRIPTION files to cover svn revision info? This would be very useful for bug reporting... I know that any developer is already free to append corresponding lines to DESCRIPTION files to do some

Re: [Rd] external equiv to R_serialize()?

2009-03-31 Thread Joe Conway
Prof Brian Ripley wrote: On Mon, 30 Mar 2009, Joe Conway wrote: I'm trying to efficiently allow conversion of R objects to PostgreSQL bytea (raw binary) datatype within PL/R for persistent storage in Postgres tables. I have found R_serialize() which looks like what I need, -- e.g. R_serialize

Re: [Rd] duplicated.data.frame {was "[R] which rows are duplicates?"}

2009-03-31 Thread Martin Maechler
> "WK" == Wacek Kusnierczyk > on Tue, 31 Mar 2009 16:03:12 +0200 writes: WK> Martin Maechler wrote: [] WK> duplicated.data.frame WK> # function (x, incomparables = FALSE, fromLast = FALSE, ...) WK> # { WK> #if (!is.logical(incomparables) || in

[Rd] what is the preferred method to create a package local variable?

2009-03-31 Thread Whit Armstrong
for the moment, I'm using: .onAttach <- function(libname, pkgname) { .bbg.db.conn <<- dbConnect(dbDriver("PostgreSQL"), user="blah","blah") } .onUnload <- function(libpath) { dbDisconnect(.bbg.db.conn) } which results in a hidden global variable in the global environment. I would prefe

Re: [Rd] Gamma funtion(s) bug

2009-03-31 Thread Ben Bolker
Martin Maechler stat.math.ethz.ch> writes: > >> But lgamma(x) is log(abs(gamma(x))), so it looks okay to me. > >> > >> Duncan Murdoch > > TH> Oops, yes! That's what comes of talking off the top of my head > TH> (I don't think I've ever had occasion to evaluate lgamma(x) >

Re: [Rd] Why does the lexical analyzer drop comments ?

2009-03-31 Thread Romain Francois
hadley wickham wrote: At the moment, I am concentrating efforts deep down in the parser code, but there are other challenges: - once the expressions are parsed, we will need something that investigates to find evidence about function calls, to get an idea of where the function is defined (by the

Re: [Rd] Why does the lexical analyzer drop comments ?

2009-03-31 Thread hadley wickham
> At the moment, I am concentrating efforts deep down in the parser code, but > there are other challenges: > - once the expressions are parsed, we will need something that investigates > to find evidence about function calls, to get an idea of where the function > is defined (by the user, in a pac

[Rd] as.data.frame peculiarities

2009-03-31 Thread Stavros Macrakis
The documentation of as.data.frame is not explicit about how it generates column names for the simple vector case, but it seems to use the character form of the quoted argument, e.g. names(as.data.frame(1:3)) [1] "1:3" But there is a strange case: names(as.data.frame(c("a"))) [1] "if (stringsAsF

Re: [Rd] duplicated.data.frame {was "[R] which rows are duplicates?"}

2009-03-31 Thread Wacek Kusnierczyk
Martin Maechler wrote: > > WK> what the documentation *fails* to tell you is that the parameter > WK> 'incomparables' is defunct > > No, not "defunct", but the contrary of it, > "not yet implemented" ! > that's my bad english, again. sorry. > WK> # data as above, or any data frame

[Rd] duplicated.data.frame {was "[R] which rows are duplicates?"}

2009-03-31 Thread Martin Maechler
> "WK" == Wacek Kusnierczyk > on Mon, 30 Mar 2009 14:26:24 +0200 writes: WK> Michael Dewey wrote: >> At 05:07 30/03/2009, Aaron M. Swoboda wrote: >>> I would like to know which rows are duplicates of each other, not >>> simply that a row is duplicate of another row. In

Re: [Rd] Possible bug in summary.survfit - 'scale' argument ignored?

2009-03-31 Thread Marc Schwartz
On Mar 30, 2009, at 5:55 PM, Marc Schwartz wrote: Hi all, Using: R version 2.8.1 Patched (2009-03-07 r48068) on OSX (10.5.6) with survival version: Version:2.35-3 Date: 2009-02-10 I get the following using the first example in ?summary.survfit: > summary( surv

Re: [Rd] Why does the lexical analyzer drop comments ?

2009-03-31 Thread Romain Francois
Hi, Thank you for this (inspired) trick. I am currently in the process of extracting out the parser from R (ie the gram.y file) and making a custom parser using the same grammar but structuring the output in a different manner, more suitable for what the syntax highlighter will need. You wil

Re: [Rd] Why does the lexical analyzer drop comments ?

2009-03-31 Thread Yihui Xie
Hi Romain, I've been thinking for quite a long time on how to keep comments when parsing R code and finally got a trick with inspiration from one of my friends, i.e. to mask the comments in special assignments to "cheat" R parser: # keep.comment: whether to keep the comments or not # keep.blank.l

Re: [Rd] [R] incoherent conversions from/to raw

2009-03-31 Thread Wacek Kusnierczyk
Martin Maechler wrote: (...) > WK> which shows that raw won't coerce to the four first types in the > WK> 'hierarchy' (excluding NULL), but it will to character, list, and > WK> expression. > > WK> suggestion: improve the documentation, or adapt the implementation > to > WK

Re: [Rd] [R] incoherent conversions from/to raw

2009-03-31 Thread Martin Maechler
> "WK" == Wacek Kusnierczyk > on Thu, 19 Mar 2009 10:17:20 +0100 writes: WK> Wacek Kusnierczyk wrote: >> interestingly, >> >> c(1, as.raw(1)) >> # error: type 'raw' is unimplemented in 'RealAnswer' >> >> WK> three more comments. WK> (1) WK

[Rd] installing RMySQL (PR#13633)

2009-03-31 Thread ankheedutta
Full_Name: Ankhee Dutta Version: 2.3 OS: LINUX Submission from: (NULL) (202.141.12.97) I have a linux system of Mandriva-2007 with R version 2.3.0 and MySQL with 5.0.0. I have also got DBI-R database interface version-0.1-11 installed on my Linux system.While installing RMySQL package version 0

Re: [Rd] Gamma funtion(s) bug

2009-03-31 Thread Martin Maechler
> "TH" == Ted Harding > on Mon, 30 Mar 2009 22:28:54 +0100 (BST) writes: TH> On 30-Mar-09 20:37:51, Duncan Murdoch wrote: >> On 3/30/2009 2:55 PM, (Ted Harding) wrote: >>> On 30-Mar-09 18:40:03, Kjetil Halvorsen wrote: With R 2.8.1 on ubuntu I get: > gamma