在本教程之后,我使用以下vb脚本:
Rexe = "R-Portable\App\R-Portable\bin\Rscript.exe" Ropts = "--no-save --no-environ --no-init-file --no-restore --no-Rconsole" RScriptFile = "runShinyApp.R" Outfile = "ShinyApp.log" strCommand = Rexe & " " & Ropts & " " & RScriptFile & " 1> " & Outfile & " 2>&1" intWindowStyle = 0 ' Hide the window and activate another window.' bWaitOnReturn = False ' continue running script after launching R ' CreateObject("Wscript.Shell").Run strCommand,intWindowStyle,bWaitOnReturn
message('library paths:\n',paste('... ',.libPaths(),sep='',collapse='\n')) chrome.portable = file.path(getwd(),'GoogleChromePortable/App/Chrome-bin/chrome.exe') launch.browser = function(appUrl,browser.path=chrome.portable) { message('Browser path: ',browser.path) shell(sprintf('"%s" --app=%s',browser.path,appUrl)) } shiny::runApp('shiny',launch.browser=launch.browser)
它在我的电脑上工作得很好……我在本地安装了chrome,但我称之为Portable Chrome可执行文件.它让我担心这两个人正在共享prefs或者其他东西,例如我注意到我安装的版本中的Preferences文件中的哈希值,具体为:
"chrome_url_overrides": { "bookmarks": [ "chrome-extension://eemcgdkfndhakfknompkggombfjjjeno/main.html" ] },
…匹配Portable Chrome安装中的相同json条目:
"chrome_url_overrides": { "bookmarks": [ "chrome-extension://eemcgdkfndhakfknompkggombfjjjeno/main.html" ] }
为什么这些长随机字符串匹配?我是不是因为想知道而错在树上?我不知道为什么这些字符串匹配,如果它们是Chrome可执行文件的两个独立安装,其中一个应该完全独立于机器上的任何东西运行.
这是一台机器的一组错误:
.../Desktop/TestApp3/GoogleChromePortable/App/Chrome-bin/chrome.exe[9100:9408:0716/141934:ERROR:gpu_info_collector_win.cc(103)] Can't retrieve a valid WinSAT assessment. [9100:9408:0716/141934:ERROR:component_loader.cc(138)] Failed to parse extension manifest. [9100:1716:0716/141946:ERROR:get_updates_processor.cc(214)] PostClientToServerMessage() Failed during GetUpdates
这是来自第二台机器的一组错误:
.../Documents/TestApp3/GoogleChromePortable/App/Chrome-bin/chrome.exe [5220:3384:0714/142128:ERROR:component_loader.cc(138)] Failed to parse extension manifest. [5220:7600:0714/142130:ERROR:external_registry_loader_win.cc(136)] File C:\Program Files\Coupons.com CouponBar\chrome\Coupons.com.crx for key Software\Google\Chrome\Extensions\cnpkmcjgpcihgfnkcjapiaabbbplkcmf does not exist or is not readable. [5220:2120:0714/142140:ERROR:get_updates_processor.cc(214)] PostClientToServerMessage() Failed during GetUpdates [5220:3384:0714/142413:ERROR:CONSOLE(122)] "Could not find value for secondaryUser",source: chrome://resources/js/load_time_data.js (122) [5220:3384:0714/142413:ERROR:CONSOLE(122)] "[undefined] (secondaryUser) is not a boolean",source: chrome://resources/js/load_time_data.js (122) [5220:3384:0714/142425:ERROR:CONSOLE(122)] "Could not find value for secondaryUser",source: chrome://resources/js/load_time_data.js (122) [5220:3384:0714/142425:ERROR:CONSOLE(122)] "[undefined] (secondaryUser) is not a boolean",source: chrome://resources/js/load_time_data.js (122) [5220:3384:0714/142442:ERROR:navigation_entry_screenshot_manager.cc(167)] Invalid entry with unique id: 12
看起来Chrome在不同的计算机上做了不同的事情,实际上并不是一个独立的浏览器…但可能通过注册表或其他一些“引擎盖,活跃”的通信与各自计算机上安装的浏览器进行交互.也许,因为我在我的机器上安装了便携式可执行文件,我的一些本地扩展或首选项会自动更新到便携式设备的首选项等,然后这会导致其他所有机器发生冲突?
我可以关闭Chrome的扩展程序或额外功能,例如调用更新程序吗?是否有更好的独立便携式浏览器,与Shiny一起运行以实现这种“部署”目的?我能解决这个问题还是这个失败的原因?这应该是显而易见的,但无论如何我都会这样说:要求非技术类型安装R,然后安装RStudio然后确认其工作目录结构,然后通过Script窗口调用runApp()命令,这在经济上是无效的. …
开始:
install.packages("RInno") require(RInno) RInno::install_inno()
create_app(app_name = "myapp",app_dir = "path/to/myapp") compile_iss()
这将创建一个与任何其他程序一样运行的安装向导,但会在Windows桌面计算机上安装您的闪亮应用程序.如果您希望为未安装R的同事添加R,请将include_R = TRUE添加到create_app:
create_app(app_name = "myapp",app_dir = "path/to/myapp",include_R = TRUE)
它默认包含shiny,magrittr和jsonlite,所以如果你使用ggplot2或plotly等其他包,只需将它们添加到pkgs参数即可.您还可以将GitHub包包含在remotes参数中:
create_app( app_name = "myapp",app_dir = "path/to/myapp" pkgs = c("shiny","jsonlite","magrittr","plotly","ggplot2"),remotes = c("talgalili/installr","daattali/shinyjs"))
如果您对其他功能感兴趣,请查看FI Labs – RInno