Re: [Rpy] na.action?

2009-09-29 Thread Nathaniel Smith
On Tue, Sep 29, 2009 at 5:28 PM, Gary Strangman wrote: rpy2.robjects.r.lm(f,myframe, na.action=NULL)  # fails; "keyword can't be an expression" rpy2.robjects.r.lm(f,myframe, na_action=NULL)  # fails; "extra arguments na_action are just disregarded" The underscore version wor

[Rpy] na.action?

2009-09-29 Thread Gary Strangman
Hi again, What is the proper syntax to set parameters like na.action in R's lm() function? For example, if I create a dataframe with NAs and want them to be dealt with via R's na.exclude, how do I formulate the call? Things like the following fail: >>> from rpy2.robjects import * >>> f = r.fo

Re: [Rpy] Making dataframes ... fast

2009-09-29 Thread Gary Strangman
Very helpful, thanks! As for having data in the "wrong" order, it's a little odd that a datafile that's perfect for loading into R as a dataframe (via read.table), is inherently in the "wrong" order for dataframe creation after reading it into python (using numpy.genfromtext(), or f.readlines(

Re: [Rpy] Making dataframes ... fast

2009-09-29 Thread Nathaniel Smith
On Tue, Sep 29, 2009 at 4:21 AM, Gary Strangman wrote: > Without benchmarking, that seems mighty inefficient. Nathaniel Smith's > rnumpy mostly allows the following: > > df = rnumpy.r.data_frame(numpy.array(d,np.object)) > > ... which is 2 conversions (rather than 4), but I haven't been able to ge

Re: [Rpy] Why I can not plot a matrix?

2009-09-29 Thread Peng Yu
On Mon, Sep 28, 2009 at 4:57 PM, Peng Yu wrote: > Hi, > > In R, I can plot a 2 column matrix >> x=1:3 >> y=1:3 >> plot(x,y) >> plot(cbind(x,y)) > > But I'm wondering why I can not do so with rpy. In the following > python code, the last line does not work. Can somebody let me know > why? > > impor

[Rpy] Alfredo has invited you to Dropbox

2009-09-29 Thread Dropbox
We're excited to let you know that Alfredo has invited you to Dropbox! Alfredo has been using Dropbox to sync and share files online and across computers, and thought you might want it too. Visit http://www.getdropbox.com/link/20.R31tleBufz/NjMxOTQ0NDE3 to get started. - The Dropbox Team ___

Re: [Rpy] Making dataframes ... fast

2009-09-29 Thread Gary Strangman
That's the problem ... I don't have the data in R format to start, nor is there a simple way of getting it there (except through python, of course, in which case I have it in python, not R ;-) I did actually use the read.table method for a while, but with several hundred thousand disk hits eac

Re: [Rpy] Making dataframes ... fast

2009-09-29 Thread Gary Strangman
Great. Thanks for the jump-start! On Tue, 29 Sep 2009, Laurent Gautier wrote: > Gary Strangman wrote: >> >> Hi Laurent, >> >> The only way to reduce the number of transformations is to add an >> equivalent number of columns to the dataframe (so that instead of several >> hundred thousand con

Re: [Rpy] Making dataframes ... fast

2009-09-29 Thread Laurent Gautier
Gary Strangman wrote: > > Hi Laurent, > > The only way to reduce the number of transformations is to add an > equivalent number of columns to the dataframe (so that instead of > several hundred thousand conversions, I need several hundred thousand > columns), and then passing this beast back-a

Re: [Rpy] Making dataframes ... fast

2009-09-29 Thread Peter
On Tue, Sep 29, 2009 at 12:21 PM, Gary Strangman wrote: > > Hi Laurent, > > The only way to reduce the number of transformations is to add an > equivalent number of columns to the dataframe (so that instead of several > hundred thousand conversions, I need several hundred thousand columns), > and t

Re: [Rpy] Making dataframes ... fast

2009-09-29 Thread Gary Strangman
Hi Laurent, The only way to reduce the number of transformations is to add an equivalent number of columns to the dataframe (so that instead of several hundred thousand conversions, I need several hundred thousand columns), and then passing this beast back-and-forth between python and R for r

Re: [Rpy] Making dataframes ... fast

2009-09-29 Thread Laurent Gautier
Gary, Two things come to my mind: - Try having an initial Python data structure that requires less transformations than your current one in order to become a DataFrame. - Use rpy2.rinterface when speed matters. This can already get you faster than R. http://rpy.sourceforge.net/rpy2/doc-dev/htm