For Data Science, SQL Server 17 has optional built in R functionality.
It also has the ability to call R Studio from within SQL Server.
The prerequisite is reliable connectivity between SQL Server and R Studio.
Here are the steps to configure SQL Server and R to work with each other.