[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)

[Rpy] python dates -> rpy dates -> ggplot2 dates, how to?

2010-04-23 Thread John Owens
Howdy, I'd like to bring Python dates into rpy2 (and then into ggplot2). How might this best be done? R evidently supports dates natively. What seems ideal is having a DateVector in the vein of FloatVector, StrVector, and so on. If I put a date in the format "datetime.date" into a Vector, python

Re: [Rpy] python dates -> rpy dates -> ggplot2 dates, how to?

2010-04-23 Thread John Owens
John Owens yahoo.com> writes: > > Howdy, I'd like to bring Python dates into rpy2 (and then into > ggplot2). How might this best be done? R evidently supports dates > natively. And as a hack, this seems to work OK for now for a 'rawdate' entry in the dataframe where 'rawdates' is a python array

Re: [Rpy] python dates -& gt; rpy dates -& gt; ggplot2 dates, how to?

2010-04-23 Thread John Owens
John Owens yahoo.com> writes: > 'rawdate': ro.StrVector([d.isoformat() for d in rawdates]), Eesh. This doesn't work. All dates are in 1970. Would thus appreciate any guidance! JDO -- _

[Rpy] conversion of R's c(a=b, i=j, x=y) syntax to rpy

2010-04-23 Thread John Owens
I haven't been able to work out how to map this syntax from R: colours <- c(carni = "red", "NA" = "orange", insecti = "yellow", herbi = "green", omni = "blue") to rpy. (This example is from p. 107 in the ggplot2 book.) Suggestions appreciated! JDO