What DO you use R for (other than data science)?

So this post asks us what AREN'T we using R for, and was an interesting read, but perhaps the opposite might be fun as well?

R is my DuctTape/WD40 all-in-one, a multitool that helps with all of life's problems... and if you are the same, then I invite you to write a post here about some of the weird applications.

I'll start us off. I have about 20-30 databases that need ODBC Source credentials to be installed on my computer, our server, and anyone who collaborates, even though all use different drivers (there are ways to query direct without saving sources in R, but not for Power BI which I use). Passing new credentials around was error-prone and annoying, so I wrote an ODBC handling repo consisting of two files:

ODBC-Exporter:

  1. The ODBC Sources are installed in my Registry (windows pc), so I export that part of the registry using system('reg export "HKEY_CURRENT_USER\\Software\\ODBC" "export.reg" /y').
  2. Using regex, I munge the code in a file called ODBC.ini (for the server, with it's different drivers and formatting), and another .reg file (for windows collaborators), ready to be shared.
  3. Use github to get stuff into the server, and for the next step for humans.

ODBC-Importer

  1. After someone has added/edited a source, pull the github repo, run the importer that will regexp the file until your drivers are listed correctly in the .reg file
  2. Double click the .reg file which imports all the sources and presto, you have a synchronized system!

This process even allows for a third script that exports a safe version of the ODBC sources (without any of the RW connections) for sharing with staff that doesn't need to be writing to the dbs!

Is this a hack? Yes. Is it awful and dangerous? Yes. Does it work and introduce order into an otherwise chaotic environment? Yes.

Now your turn!

3 Likes

I started learning r so that I can automate my MIS workflows and reports faster than VBA.

  1. Automated excel reports

  2. Shiny dashboards

  3. Rinno desktop applications

This is all I have used r for

2 Likes

Hi, we have some options to secure credentials when connecting to databases in a site that we created to help with R & Databases: http://db.rstudio.com/best-practices/managing-credentials/

2 Likes

Thanks Edgar, that's great for handling credentials in the files themselves... however that still doesn't address the fact that we need to install odbc sources inside /etc/odbc.ini or as registry items. That's what this hack is about. That being said, there is one place where I do have one ODBC password unencrypted in the R code and I definitely will look into keyring to handle that... it's been on my todo list for about 2 years now :slight_smile:

I use it for die rolls when playing Dungeons & Dragons over Skype with some friends I recently reconnected with from college.

d = function(max=20, ndice=1, min=1) {
  sample(min:max, ndice, replace=TRUE)
}

# Roll 1 20-sided die
d()

# Roll 3 6-sided dice
d(6, 3)

# Roll 2 10-sided dice (for percents)
d(9, 2, 0)
6 Likes

You should build a little Shiny app around it and make it into a package, @joels!

5 Likes

If it were on slack you could make a bot with slackr :slight_smile:

1 Like