We've talked before about integrating scripting engine (such as R)
into dhis : rscript - Java to R scripting interface - RForge.netBut my guess is that most R users are going to be of a level of
sophistication that they would be most comfortable doing the kind of
thing you describe - conecting directly to db with r client and doing
their stuff.OTOH if there were sufficiently useful "canned" dhis R scripts which
could take some number crunching load off the jvm and produce canned
useful analysis then that would be different.
In fact Ola and I earlier had discussions with someone who had
integrated R scripts in his own Access based system, but would have
been delighted to switch to DHIS2 as the platform if we could
accommodate the scripts.
And it would be a way to quite quickly enhance the analytical
capabilities, if DHIS2 came with a set of good scripts - perhaps after
being refined and generalized through the more ad hoc process Jason
describes. And one could imagine most of the "plumbing tasks" could
have been taken care of, leaving a simpler and more efficient
interface for a wider audience.
Knut
···
On Thu, May 27, 2010 at 11:45 AM, Bob Jolliffe <bobjolliffe@gmail.com> wrote:
Sadly I don't know sufficient about R to know. But I sense it ...
Regards
BobOn 27 May 2010 10:08, Jason Pickering <jason.p.pickering@gmail.com> wrote:
Hi everyone. I have had a recent question from a user about how DHIS2
can be used with R. I am including a trivial example here about how to
use R as as a client to access data and produce a graph in DHIS2.Just get a copy of R and install the DBI and RPostregSQL packages with
install.packages()
After that, just connect to the DB, retrieve your data (in this case
from a report table) and produce a graph.library(DBI)
library(RPostgreSQL)
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, dbname="dhis2_zm_prod2", user="postgres", password="postgres")
rs <- dbSendQuery(con, "SELECT * FROM _report_malaria_indicators_district where
organisationunitid = 3904")
data <- fetch(rs,n=-1)
barplot(data$malaria_confirm_incidence, names.arg=as.character(data$periodname), main=as.character(data$organisationunitname[1]),las=2)
dev.print(png, file="/home/jason/test.png")
Regards,
Jason---
Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+260968395190_______________________________________________
Mailing list: DHIS 2 developers in Launchpad
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : DHIS 2 developers in Launchpad
More help : ListHelp - Launchpad Help_______________________________________________
Mailing list: DHIS 2 developers in Launchpad
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : DHIS 2 developers in Launchpad
More help : ListHelp - Launchpad Help
--
Cheers,
Knut Staring