=== modified file 'src/docbkx/en/dhis2_r.xml' --- src/docbkx/en/dhis2_r.xml 2012-05-10 12:15:27 +0000 +++ src/docbkx/en/dhis2_r.xml 2012-05-21 13:22:42 +0000 @@ -67,7 +67,7 @@ Debug = 0 Finally, we need to install the ODBC connection with odbcinst -i -d -f odbc.ini - This shows that R is working properly. + From the R prompt, execute the following commands to connect to the DHIS2 database. > library(RODBC) > channel<-odbcConnect("dhis2")#Note that the name must match the ODBC connector name @@ -151,8 +151,7 @@
Using R with MyDatamart MyDatamart provides useful interface to the DHIS2 database by making a local copy of the database available on a users desktop. This means that the user does not need direct access to the database and the data can be worked with offline on the users local machine. In this example, we will have used the demo database. Data was downloaded at the district level for Jan 2011-Dec 201l. Consult the MyDatamart section in this manual for more detailed information. - - First, lets load some required packages. If you do not have these packages already installed in your version of R, you will need to do so before proceeding with the example. + First, lets load some required R packages. If you do not have these packages already installed in your version of R, you will need to do so before proceeding with the example. library("DBI") library("RSQLite") library("lattice") @@ -393,7 +392,7 @@ Using packages like brew or Rapache, these types of graphs could be easily integrated into external web sites. A fully functional version of the chart shown above can be accessed here.
-
+
Using PL/R with DHIS2 The procedural language for R is an extension to the core of Postgresql which allows data to be passed from the database to R, where calculations in R can be performed. The data can then be passed back to the database for further processing.. In this example, we will create a function to calculate some summary statistics which do not exist by default in SQL by using R. We will then create an SQL View in DHIS2 to display the results. The advantage of utilizing R in this context is that we do not need to write any significant amount of code to return these summary statistics, but simply utilize the built-in functions of R to do the work for us. First, you will need to install PL/R, which is described in detail here.. Following the example from the PL/R site, we will create some custom aggregate functions as detailed here. We will create two functions, to return the median and the skewness of a range of values. @@ -438,5 +437,6 @@ + In this simple example, we have shown how to use PL/R with the DHIS2 database and web interface to display some summary statistics using R to perform the calculations.
=== modified file 'src/docbkx/en/dhis2_user_manual_en.xml' --- src/docbkx/en/dhis2_user_manual_en.xml 2012-04-29 20:52:52 +0000 +++ src/docbkx/en/dhis2_user_manual_en.xml 2012-05-21 13:22:42 +0000 @@ -60,6 +60,7 @@ + DHIS 2 Workbook