------------------------------------------------------------ revno: 528 committer: Jason P. Pickering <[email protected]> branch nick: dhis2-docbook-docs timestamp: Fri 2012-06-01 08:01:20 +0200 message: Minor fix. modified: src/docbkx/en/dhis2_r.xml
-- lp:~dhis2-documenters/dhis2/dhis2-docbook-docs https://code.launchpad.net/~dhis2-documenters/dhis2/dhis2-docbook-docs Your team DHIS 2 developers is subscribed to branch lp:~dhis2-documenters/dhis2/dhis2-docbook-docs. To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-documenters/dhis2/dhis2-docbook-docs/+edit-subscription
=== modified file 'src/docbkx/en/dhis2_r.xml' --- src/docbkx/en/dhis2_r.xml 2012-05-23 14:54:01 +0000 +++ src/docbkx/en/dhis2_r.xml 2012-06-01 06:01:20 +0000 @@ -446,9 +446,18 @@ require(RCurl) require(XML) #Just a URL with some data -url<-"https://apps.dhis2.org/dev/api/reportTables/data.csv?de=fbfJHSPpUQD&de=cYeuwXTCPkU&in=Uvn6LCg7dVU&ou=O6uvpzGd5pu&last12Months=true" + +url<-"https://apps.dhis2.org/dev/api/reportTables/data.csv? +de=fbfJHSPpUQD +&de=cYeuwXTCPkU +&in=Uvn6LCg7dVU +&ou=O6uvpzGd5pu +&last12Months=true" #Lets get the response and we do not need the headers -response<-getURL(url,userpwd="admin:district",httpauth = 1L, header=FALSE) +#This site has some issues with its SSL certificate +#so lets not verify it. +response<-getURL(url,userpwd="admin:district" +,httpauth = 1L, header=FALSE,ssl.verifypeer = FALSE) #Unquote the data data<-noquote(response) #here is the data. @@ -458,10 +467,12 @@ <para>Here, we have shown how to get some aggregate data from the DHIS2 demo database using the DHIS2's Web API.</para> <para>In the next code example, we will retrieve some metadata, namely a list of data elements and their unique identifiers.</para> <screen>#Get the list of data elements. Turn off paging and links +#This site has some issues with its SSL certificate +#so lets not verify it. url<-"https://apps.dhis2.org/dev/api/dataElements.xml? paging=false&links=false" response<-getURL(url,userpwd="admin:district", -httpauth = 1L, header=FALSE) +httpauth = 1L, header=FALSE,ssl.verifypeer = FALSE) #We ned to parse the result bri<-xmlParse(response) #And get the root @@ -474,9 +485,10 @@ #but we need to be careful for missing attribute values foo<-cbind(de_names,de_id) #Recast this as a data frame -data_elements<-as.data.frame(foo,stringsAsFactors=FALSE,row.names=1:nrow(foo)) +data_elements<-as.data.frame(foo, +stringsAsFactors=FALSE,row.names=1:nrow(foo)) head(data_elements) </screen> - <para>Note that the values which we are interested in are stored as XML attributes and were parsed into two seperate matrices and then combined together into a single data frame. </para> + <para>Note that the values which we are interested in are stored as XML attributes and were parsed into two separate matrices and then combined together into a single data frame. </para> </section> </chapter>
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : [email protected] Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp

