Re: [Rpy] dataframe: removing rows and changing internal elements

2010-05-20 Thread Laurent
On 21/05/10 00:08, John Owens wrote: > I'd like to do two (actually three) things: > > 1) Using a grep-like operator, delete rows in a dataframe that match a > particular pattern in a particular column (in my case, every row that > has a '#' as the first character in column 'a') > 2) Set el

[Rpy] dataframe: removing rows and changing internal elements

2010-05-20 Thread John Owens
I'd like to do two (actually three) things: 1) Using a grep-like operator, delete rows in a dataframe that match a particular pattern in a particular column (in my case, every row that has a '#' as the first character in column 'a') 2) Set elements in a dataframe based on the characteristics

[Rpy] dataframe from structured numpy array

2010-04-23 Thread Gary Strangman
Hi all, I have a mixed-type structured numpy array (including columns of ints, floats and strings), sometimes with missing values. In rpy2-2.1, what is the recommended (including fastest and least memory-expensive) way to convert such a structure to an R dataframe? Here's where I've been: 1)

Re: [Rpy] Dataframe conversion question

2008-12-14 Thread Gary Strangman
>> I have a list-of-lists that I want to convert to an R dataframe. (In R, it >> should end up as 306 rows by 12 columns.) The rpy2 instructions suggested >> in this forum were basically: (1) convert my list of lists to a list of >> array.array()s, (2) convert each array.array() to an RVector,

Re: [Rpy] Dataframe conversion question

2008-12-14 Thread Gary Strangman
Actually, I hadn't. But trying it gave me the same "raveled" result: >>> len(dl) 12 >>> map(len,dl) [306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306] >>> x=ro.r['data.frame'](dl) >>> len(x) 3672 >>> On Sat, 13 Dec 2008, Marcos Silva wrote: > Well, I don't know RPy nor Python enought

Re: [Rpy] Dataframe conversion question

2008-12-13 Thread Laurent Gautier
Gary Strangman wrote: > Hi again, > > I have a list-of-lists that I want to convert to an R dataframe. (In R, it > should end up as 306 rows by 12 columns.) The rpy2 instructions suggested > in this forum were basically: (1) convert my list of lists to a list of > array.array()s, (2) convert ea

Re: [Rpy] Dataframe conversion question

2008-12-13 Thread Marcos Silva
Well, I don't know RPy nor Python enought, and maybe I misunderstand your data structure, but did you tried the RPy corresponding to the R function"as.data.frame(dl)" Cheers 2008/12/13 Gary Strangman > > Hi again, > > I have a list-of-lists that I want to convert to an R dataframe. (In R, it >

[Rpy] Dataframe conversion question

2008-12-13 Thread Gary Strangman
Hi again, I have a list-of-lists that I want to convert to an R dataframe. (In R, it should end up as 306 rows by 12 columns.) The rpy2 instructions suggested in this forum were basically: (1) convert my list of lists to a list of array.array()s, (2) convert each array.array() to an RVector, (

Re: [Rpy] DataFrame

2008-10-28 Thread Mark Janikas
Thanks much! Should have searched harder I guess. MJ -Original Message- From: laurent [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 28, 2008 2:08 PM To: Mark Janikas Cc: RPy help, support and design discussion list Subject: Re: [Rpy] DataFrame On Tue, 2008-10-28 at 13:35 -0700

Re: [Rpy] DataFrame

2008-10-28 Thread laurent
On Tue, 2008-10-28 at 13:35 -0700, Mark Janikas wrote: > In rpy you were able to create a dataframe from a dictionary. Is > there a way to do that in rpy2? It appears you need to use a > taggedlist now. Any info would be greatly appreciated. TY, This was discussed recently on the mailing-lis

[Rpy] DataFrame

2008-10-28 Thread Mark Janikas
In rpy you were able to create a dataframe from a dictionary. Is there a way to do that in rpy2? It appears you need to use a taggedlist now. Any info would be greatly appreciated. TY, MJ EXAMPLE: In [29]: from rpy import * In [30]: set_default_mode(NO_CONVERSION) In [31]: d = {"Test":[1,2