I currently have the following R script that works in console.
results <- fetch(dbSendQuery(con, query), n=-1)
results$date <- as.POSIXct(results$date)
plot(results$date, results$DIFF, ylab="Run differential", xlab="2009",
xaxt="n")
axis.POSIXct(1, at=seq(min(results$date), max(results$date), length=5),
format="%b %d", lwd=0, lwd.ticks=1.5)
lines(results$date, results$DIFF, type="l", lwd=1.5, col="red", pch=15)
title(main="Run differential for the 2009 Seattle Mariners")
However, in my python script, I'm doing the query w/ MySQLdb, and then
trying:
r.png('%s%d.png' % (path, team_id), width=450, height=450)
r.plot(dates, diff, ylab='Run differential', xlab='2009', xaxt='n')
r.lines(dates, diff, col='red', lwd='1.5.')
Where diff and dates are lists of values: diff being numeric, and dates
being a list of datetime.date objects, for which python errors:
ValueError: Nothing can be done for the type <type 'datetime.date'> at the
moment.
However, making these strings errors like:
rinterface.RRuntimeError: Error in plot.window(...) : need finite 'xlim'
values
Which is what happens when you don't run the "results$date <-
as.POSIXct(results$date)" line in the R script.
Any ideas on how I can properly translate the R bit to rpy? Thanks!
--
Wells Oliver
we...@submute.net
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list