我在 JMP 中編寫了一個腳本,利用 R 來幫助客戶從其資料集中獲取一些特定資訊。他們以前從未安裝過 R,所以我幫他們安裝了它(我已經安裝了幾十次)。如果 JMP 在電腦上找不到 R(它使用 Throw(rconn = R Connect();,...) 語句),我的腳本會引發錯誤。安裝 R 時 JMP 正在運行,我運行了腳本,但它找不到 R。我重新啟動計算機,運行腳本 - 同樣的錯誤。我卸載了 R,退出了 JMP,安裝了 R,啟動了 JMP - 同樣的錯誤。那麼,我想知道的是,我可以透過指定目的地來幫助JMP找到R嗎? JMP 支援檔案顯示:
How JMP Finds R
JMP delays loading R until a JSL-based script requires access to it. When JMP needs to load R, it follows the standard steps for finding R on a Windows computer:
1.Look up the environment variable R_HOME.
If the variable exists, load R from the specified directory.
2.If the environment variable R_HOME does not exist, look up the InstallPath value in the Windows registry under the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\R-core\R
For 32-bit JMP running on a 64-bit machine, the InstallPath value is under the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432NODE\R-core\R
If the InstallPath value exists, load R from the specified directory.
3.If the InstallPath value does not exist, an error message states that R could not be found.
我可以指定環境變數 R_HOME 或傳遞 InstallPath 值嗎?
事實證明,解決方案是使用者在電腦上沒有管理權限(看起來他們有,因為他們可以安裝 R)。一旦我們卸載了 R,請求了管理權限並重新安裝了 R,一切就正常了。
我會注意到,進一步調查顯示該註冊表項位於 HKEY_LOCAL_USER\...而不是 HKEY_LOCAL_MACHINE\...
我不知道為什麼這個人的 R 鍵在那裡,而不是我和其他人的 R 鍵,但我的問題是,我可以簡單地指示 JMP 尋找不同的註冊表鍵嗎?