You can connect and directly query your data via SQL using R. Here we are using R within the Rstudio IDE, but the same steps will work within a standard R session or Revo R.
Firstly you will need to install the RPostgreSQL package.
1 |
install.packages('RPostgreSQL') |
Once the package is installed we can activate it and establish a connection to the deltaDNA database
1 2 3 |
library(RPostgreSQL) drv<-dbDriver("PostgreSQL") conn<-dbConnect(drv,user="YourDeltaDNALogin",password="YourPasswordHere", host = "data.deltadna.net",dbname="demo-co.my-demo-game") |
Where you the user, password are the username and password you use to login to www.deltadna.net, and dbname is your company name and game name as shown in the address bar of your browser on the www.delatDNA.net e.g. demo-co.my-demo-game NB there should be a full stop between the account name and the game name.
You can then write queries as R strings and pass them to the database, they will be returned as R data frames
1 2 |
qry<-'select count(distinct userID) from events_live' qry.df<-dbGetQuery(conn,qry) |