[Rpy] Using plot with panels under rpy2

2012-01-26 Thread William T. Martin
Has anyone used the R plot function with the panel= option under rpy2? I am stuck and need some assistance. The R code would have this format (zz is a zoo series): plot(zz, panel = my.panel, xaxt = "n", main="testing", xlab="Date") my.panel <- function(...) { fmt <- "%b-%d" # format for

[Rpy] How to access aggregate date text?

2011-10-13 Thread William T. Martin
How do I access the formatted month headers in an aggregated time series? z1 is a zooreg time series that I want to aggregate by month: ma = r.aggregate(z1, r['as.yearmon'], r.mean, **{'na.rm': True}) When I print the result vector, I get month/year information along with the mean values: >>>

[Rpy] Problem solved: Re: Running rpy2 under Apache using mod_wsgi?

2011-10-13 Thread William T. Martin
I fixed the problem I was having importing R libraries while running running rpy2 on an Apache server under mod_wsgi (Bottle). Instead of r.library("zoo") I need to use zoo=importr('zoo') Bill On 10/13/2011 1:00 PM, William T. Martin wrote: > Has anyone s

[Rpy] Running rpy2 under Apache using mod_wsgi?

2011-10-13 Thread William T. Martin
Has anyone successfully run rpy2 on an Apache server using mod_wsgi? I am using the rpy2 v.2.3.0 under Ubuntu. The base robjects work fine, but the rpy2 program hangs up on the first r.library() statement. Thank you --

[Rpy] How to specify na_rm=True?

2011-10-05 Thread William T. Martin
How do I specify na.rm=True to ignore NA vector values? The following code: import rpy2.robjects as ro import rpy2.rinterface as ri r=ro.r data=ro.FloatVector([10, 20, 30]) print(data) m=r.mean(data, na_rm=ri.TRUE) print(m) data_NA=ro.FloatVector([10, 20, 30, ro.NA_Real]) print(data_NA) m_NA=r.

[Rpy] Converting non-numbers to NA in robjects.FloatVector?

2011-10-04 Thread William T. Martin
I have a string s="70 75 none 80" that I would like to convert to an robjects.FloatVector f, which in R would be f<-(70, 75, NA, 80) Under py2-2.0, this works for me: >>> import rpy2.robjects as robjects >>> readings="70 80 none 90" >>> f=robjects.FloatVector(readings.split(" ")) >>> print(f)

[Rpy] Converting non-numbers to NA in robjects.FloatVector?

2011-10-04 Thread William T. Martin
I have a string s="70 75 none 80" that I would like to convert to an robjects.FloatVector f, which in R would be f<-(70, 75, NA, 80) Under py2-2.0, this works for me: >>> import rpy2.robjects as robjects >>> readings="70 80 none 90" >>> f=robjects.FloatVector(readings.split(" ")) >>> print

[Rpy] How to predefine a vector of a specific size and fill with NA?

2011-10-03 Thread William T. Martin
I would like to do the rpy2 equivalent of the following: (a <- rep(NA, 2000)) The rpy2 documentation says that missing values for NA_INTEGER, NA_LOGICAL, and NA_REAL are broken. Thank you Bill -- All the data c