The following links may help navigating this page
WHO Disease Outbreak News

Database Connectivity with R · 2006-02-23

There was one thing missing for fully automated dataprocessing with R here on my machine: Database Connectivity. R actually has it for some databases. I tried it with MySQL.

One needs to download Bell Labs's R libraries DBI and RMySQL and then follow the instructions at R Data Import/Export.

To test it I used the access logs I was exploring lately. I created a view, 'hitsperminute' on the database containing the hits per minute on free-penguin, as the name suggests. Adding database connectivity to R was no fuzz at all. It just worked. Consider the following code:

con <- dbConnect(dbDriver("MySQL"), dbname = "webstats", password="*****", username="dbuser")
a <- dbGetQuery(con, paste("SELECT * FROM hitsperminute;"))
  axes=FALSE, type="n",
  main="Free Penguin News Quake",
  sub=" requests per minute from Jan 2nd to Jan 8th 2006")
axis(1, label=FALSE)

the result is this recent one, but skipping manual steps. Scripts like this are fully batch mode enabled. One could run it on http requests for example. Cool, ain't it?

Commenting is closed for this article.