我想在我的Ubuntu 14.10笔记本电脑上运行http://rstudio.github.io/shinydashboard/.
我按照安装说明进行操作:
http://rstudio.github.io/shinydashboard/get_started.html
基本shiny页面有效.例如:
但是,当我尝试其中一个shinydashboard示例时,我收到错误:
ERROR: there is no package called "shinydashboard"
Run Code Online (Sandbox Code Playgroud)
如果我在终端中运行R会话,我可以加载shinydashboard
库,如果我在R会话中复制+粘贴此代码,我会在仪表板上显示一个浏览器窗口:
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody()
)
server <- function(input, output) { }
shinyApp(ui, server)
Run Code Online (Sandbox Code Playgroud)
它说:
Attaching package: 'shinydashboard'
The following object is masked from 'package:graphics':
box
>
> ui <- dashboardPage(
+ dashboardHeader(),
+ dashboardSidebar(),
+ dashboardBody()
+ )
>
> server <- function(input, output) { }
>
> shinyApp(ui, server) …Run Code Online (Sandbox Code Playgroud) 我在ubuntu服务器上安装了闪亮的服务器.我在开发服务器上做了类似的安装工作.当他们打开R会话加载一些包.该应用程序在本地运行正常,但我收到的消息是,它在发光服务器上运行时找不到包.
应用程序上的错误
During startup - Warning messages:
1: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called ‘shiny’
2: package ‘shiny’ in options("defaultPackages") was not found
3: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called ‘data.table’
4: package ‘data.table’ in options("defaultPackages") was not found
5: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called ‘optiRum’ …Run Code Online (Sandbox Code Playgroud) 对于我的系统:Ubuntu 12.04和R 3.03,每当我在R via中安装自定义包时
>install.packages()
Run Code Online (Sandbox Code Playgroud)
默认安装包
/home/USER/R/x86_64-pc-linus-gnu-library/3.0/
Run Code Online (Sandbox Code Playgroud)
而不是全系统的
/usr/local/lib/R/site-library/
Run Code Online (Sandbox Code Playgroud)
这是发光服务器使用该包所需要的.
我的临时解决方案是在事后将包复制到正确的文件夹.
问题:如何从一开始就设置默认安装路径以避免此问题?
我正在尝试使用闪亮创建一个Web应用程序.它需要我加载我在计算机上安装的软件包.例如:
## Contents ui.R:
library(shiny)
library(plyr)
shinyUI(pageWithSidebar(
headerPanel("Hello Shiny!"),
sidebarPanel(
sliderInput("obs",
"Number of observations:",
min = 0,
max = 1000,
value = 500)
),
mainPanel(
plotOutput("distPlot")
)
))
## Contents server.R:
library(shiny)
library(plyr)
shinyServer(function(input, output) {
output$distPlot <- renderPlot({
# generate an rnorm distribution and plot it
dist <- rnorm(input$obs)
hist(dist)
})
})
Run Code Online (Sandbox Code Playgroud)
如果我在本地运行它(使用runApp),但是当我尝试通过我的服务器(同一台计算机)运行它时,我得到的错误是plyr我没有安装包(或我尝试使用这种方式的任何其他包)的错误.我怎么能在闪亮的服务器中使用额外的包?