For some time, years in fact, this endeavor has banged the drum for R in database. PL/R on Postgres was the choice for quite a while. Now we have R in SQL Server, and more publicly as time goes on.
Thanks to the folks at simple-talk, we get a link to this piece. With SQL Server soon to be standard product on linux (if not exorbitantly priced), we all get to do this sort of thing.