I like working with R in a SQLServer environment. You sometimes you have situations where developing certain data manipulations is a hassle in T-SQL. Specifically when you want to do advanced string manipulations or complex regex lookups. In such a case using the stringi package could provide a huge help.
There is a nice (recently updated) tutorial on the Microsoft site on using R and SQL, or you can use the code in this article to quickly call your custom R code from your existing environment.
It is not too difficult to built in checks if the code is begin run from the server or local from within your R-Studio environment. Just check if the InputDataSet exist.
In this way you can easily deploy your R-code to the server using your preferred version control software.