官术网_书友最值得收藏!

Using R Tools for Visual Studio (RTVS) 2015 or higher

With SQL Server 2016, Microsoft recommended installing missing packages through RTVS. The user should have installed RTVS (https://www.visualstudio.com/vs/rtvs/) on a client in order to install packages. Check the default paths:

sessionInfo()
.libPaths()  

This also returns the paths to the library folders on my machine-for R Server (by default C:/Program Files/Microsoft SQL Server/MSSQL14.MSSQLSERVER/R_SERVICES/library) and for the user (C:/Users/Tomaz/Documents/R/win-library/3.2) who is currently using RTVS:

Figure 17

Checking the Options... section:

Figure 18

Then select R Tools | Advanced (as shown next):

Figure 19

You will see that the R Engine has a path defined. This path is the root path for installing R packages. R packages are installed under the subfolder-library (C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\R_SERVICES\Library).

So, by running install.packages("AUC"), I can see that the server path was ignored and the library was installed into the user specified folder:

Figure 20

To install the package in the R Server folder, you need to have administrator-level access or have an administrator do it for you. Microsoft has discussed this issue on MSDN (https://docs.microsoft.com/en-us/sql/advanced-analytics/r/installing-and-managing-r-packages). Running Visual Studio and RTVS as an administrator does not change the result. To avoid this problem, you need to declare the path to the library folder of the R Server where you want package to be installed:

install.packages("AUC", dependencies = TRUE, lib = "C:/Program Files/Microsoft SQL Server/MSSQL14.MSSQLSERVER/R_SERVICES/library")  

The package will automatically be installed in the R Server repository folder:

Figure 21
主站蜘蛛池模板: 长汀县| 张掖市| 华坪县| 广昌县| 炉霍县| 社旗县| 平度市| 瑞金市| 奉贤区| 海城市| 阿尔山市| 兰西县| 米林县| 连州市| 泗水县| 克山县| 社会| 马尔康县| 汝城县| 柘荣县| 宣武区| 平南县| 深州市| 从江县| 满洲里市| 栾城县| 英山县| 香港 | 望城县| 夏河县| 夹江县| 五大连池市| 平乐县| 河北省| 泰顺县| 沈丘县| 红原县| 米泉市| 澄江县| 宾川县| 丹阳市|