RStudio错误(Windows):没有名为'shinydashboard'的软件包

时间:2018-01-05 10:55:43

标签: r shiny shinydashboard

Realted to this question

It may be the same question as this, however it stood unanswerd

我确实有同样的问题,我无法加载库“shinydashboard”。我发现了上面的问题,但解决方案仅针对Ubuntu / Linux。我正在使用RStudio和Windows,无法使用该解决方案。

我的代码:

## app.R ##
install.packages("shinydashboard")
library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody()
)

server <- function(input, output) { }

shinyApp(ui, server)

我收到以下错误消息:

  

库中的错误(shinydashboard):     没有名为'shinydashboard'的包

将install.packages中的lib参数更改为

 install.packages("shinydashboard",lib="C:/Program Files/R/R-3.4.1/library")

我收到以下错误: 是的:

Warning in install.packages :
  'lib = "C:/Program Files/R/R-3.4.1/library"' is not writable
trying URL 
'https://cran.rstudio.com/bin/windows/contrib/3.4/shinydashboard_0.6.1.zip'
Content type 'application/zip' length 305360 bytes (298 KB)
downloaded 298 KB

package ‘shinydashboard’ successfully unpacked and MD5 sums checked
Warning in install.packages :
  unable to move temporary installation ‘C:\Users\D0282530\Documents\R\win-
library\3.4\file1e4419db2614\shinydashboard’ to 
‘C:\Users\D0282530\Documents\R\win-library\3.4\shinydashboard’

The downloaded binary packages are in
    C:\Users\D0282530\AppData\Local\Temp\Rtmpg3TVPL\downloaded_packages
Error in library(shinydashboard) : 
  there is no package called ‘shinydashboard’ 

对于否:

Warning in install.packages :
  'lib = "C:/Program Files/R/R-3.4.1/library"' is not writable
Error in install.packages : unable to install packages
Error in library(shinydashboard) : 
  there is no package called ‘shinydashboard’

1 个答案:

答案 0 :(得分:0)

正如@Roland所提到的,软件包已安装到错误的库中(仅适用于我自己的用户帐户)。在尝试将其安装到另一个库并出现写访问问题后,我最终手动将该文件夹复制到第二个(可供所有用户使用)库。