DHIS2 Web API and R

Hi All,

I found an easier implementation of the example of using R with DHIS2. I found that httr library in R is easier and uses fewer lines of code to achieve the same.

See below.

#Library to use library(httr) #This is a URL endpoint for a report table which we can get from the WebAPI. myurl<-"[https://play.dhis2.org/dev/api/reportTables/KJFbpIymTAo/data.csv](https://play.dhis2.org/dev/api/reportTables/KJFbpIymTAo/data.csv)
" #Use httr to get the data from demo dhis2 response<-GET(url=myurl, authenticate(user="admin", password="district")) #Here is the data mydata<-content(response, type="text/csv") head(mydata)

Regards,

Charles Waka

1 Like

Thank you for the share

I appreciate

Cordially

Thanks

···

On Wed, Oct 17, 2018, 10:17 Waka Wafubwa charlwak@gmail.com wrote:

Hi All,

I found an easier implementation of the example of using R with DHIS2. I found that httr library in R is easier and uses fewer lines of code to achieve the same.

See below.

#Library to use library(httr) #This is a URL endpoint for a report table which we can get from the WebAPI. myurl<-"[https://play.dhis2.org/dev/api/reportTables/KJFbpIymTAo/data.csv](https://play.dhis2.org/dev/api/reportTables/KJFbpIymTAo/data.csv)
" #Use httr to get the data from demo dhis2 response<-GET(url=myurl, authenticate(user="admin", password="district")) #Here is the data mydata<-content(response, type="text/csv") head(mydata)

Regards,

Charles Waka


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp