R - Ubuntu 上的闪亮服务器 [英] R - shiny server on Ubuntu
问题描述
我是 R、Shiny、Shiny Server 和 Ubuntu 12.04 的新手.经过漫长的一天,除了实际让闪亮的服务器托管我的应用程序之外,我几乎一切正常.我正在尝试在本地托管我的应用程序.
I'm fairly new to R, Shiny, Shiny Server and Ubuntu 12.04. After a long day I've got just about everything working except for actually having shiny-server host my app. I'm trying to host my app locally.
这是我的错误:
Error in library(ggplot2) : there is no package called ‘ggplot2’ Calls: runApp ...
startAppDir -> sys.source -> eval -> eval -> library
Execution halted
这是>sessionInfo() 生成的一些相关信息:
And here is some relevant info generated by >sessionInfo():
R version 3.0.3 (2014-03-06)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] gridExtra_0.9.1 shiny_0.9.1 ggplot2_0.9.3.1
loaded via a namespace (and not attached):
[1] bitops_1.0-6 caTools_1.16 colorspace_1.2-4 dichromat_2.0-0
[5] digest_0.6.4 gtable_0.1.2 httpuv_1.2.3 labeling_0.2
[9] MASS_7.3-30 munsell_0.4.2 plyr_1.8.1 proto_0.3-10
[13] RColorBrewer_1.0-5 Rcpp_0.11.1 reshape2_1.2.2 RJSONIO_1.0-3
[17] scales_0.2.3 stringr_0.6.2 tcltk_3.0.3 tools_3.0.3
[21] xtable_1.7-3
>
我在没有 Shiny-server 的情况下进行了测试,该应用程序运行良好
I tested without shiny-server and the app works fine
runApp("/var/shiny-server/www/examples/MY_APP/")
我还测试了 Shiny-server 附带的示例,它们运行良好,但不使用 ggplot2.
I've also tested the examples that came with shiny-server and they work fine but they don't use ggplot2.
ggplot2 显然已安装,所以我怀疑这是权限问题(?),但我不知道如何修复它...
ggplot2 is clearly installed so I suspect it's a permission issue (?) but I don't know how to fix it...
感谢您的帮助!
*解决方案*使用 .libPaths() 我能够确定由
*SOLUTION* Using .libPaths() I was able to determine that custom packages installed by
>install.packages("ggplot2")
放在主目录下
/home/USER/R/x86_64-pc-linux-gnu-library/3.0/ggplot2
我必须将文件夹~3.0/"中的每个文件都复制到
I had to copy every file from folder '~3.0/' into
/usr/local/lib/R/site-library
现在可以使用了!谢谢:D
It works now! Thanks :D
推荐答案
尝试将 ggplot2
包安装到系统目录(不是本地用户目录),运行
Try installing ggplot2
package to the system directory (not local user directory), by running
sudo R
(within R session)
install.packages('ggplot2')
由于 shiny
可能以不同的用户名运行,因此它可能无法访问您本地安装的 R 库.
Since shiny
may run under a different user name, it may not have access to your locally installed R libraries.
这篇关于R - Ubuntu 上的闪亮服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!