我已经按照演示部分中官方 GitHub 页面上的说明安装了 R 包 shinydashboardPlus
:https://github.com/RinteRface/shinydashboardPlus
按照指示,我安装并加载了包以及包依赖项。然后尝试在 R Studio 中使用命令 >shinydashboardPlusGallery()
运行shinydashboardPlus的演示仪表板,但失败并给出了错误。
然后我超越并安装并加载了几个软件包只是为了确定,但它仍然不起作用。
下面是我的代码:
install.packages("pacman")
# List all the packages to be used below.
pacman::p_load(shiny, shinydashboard, shinydashboardPlus, styler, shinyAce, shinyWidgets, shinyjqui, shinyEffects)
library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
shinydashboardPlusGallery()
我收到的错误如下:
> shinydashboardPlusGallery()
This Font Awesome icon ('fa fa-angle-down') does not exist:
* if providing a custom `html_dependency` these `name` checks can
be deactivated with `verify_fa = FALSE`
This Font Awesome icon ('gears') does not exist:
* if providing a custom `html_dependency` these `name` checks can
be deactivated with `verify_fa = FALSE`
This Font Awesome icon ('clock-o') does not exist:
* if providing a custom `html_dependency` these `name` checks can
be deactivated with `verify_fa = FALSE`
This Font Awesome icon ('clock-o') does not exist:
* if providing a custom `html_dependency` these `name` checks can
be deactivated with `verify_fa = FALSE`
This Font Awesome icon ('clock-o') does not exist:
* if providing a custom `html_dependency` these `name` checks can
be deactivated with `verify_fa = FALSE`
This Font Awesome icon ('clock-o') does not exist:
* if providing a custom `html_dependency` these `name` checks can
be deactivated with `verify_fa = FALSE`
This Font Awesome icon ('gears') does not exist:
* if providing a custom `html_dependency` these `name` checks can
be deactivated with `verify_fa = FALSE`
This Font Awesome icon ('clock-o') does not exist:
* if providing a custom `html_dependency` these `name` checks can
be deactivated with `verify_fa = FALSE`
This Font Awesome icon ('clock-o') does not exist:
* if providing a custom `html_dependency` these `name` checks can
be deactivated with `verify_fa = FALSE`
This Font Awesome icon ('clock-o') does not exist:
* if providing a custom `html_dependency` these `name` checks can
be deactivated with `verify_fa = FALSE`
This Font Awesome icon ('clock-o') does not exist:
* if providing a custom `html_dependency` these `name` checks can
be deactivated with `verify_fa = FALSE`
Error in dashboardPage(md = FALSE, dashboardHeader(fixed = TRUE, title = tagList(span(class = "logo-lg", :
unused arguments (md = FALSE, controlbar = dashboardControlbar(skin = "dark", controlbarMenu(controlbarItem(title = "Tab 1", icon = icon("desktop"), active = TRUE, sliderInput(inputId = "inputsidebar1", label = "Number of observations:", min = 0, max = 1000, value = 500)), controlbarItem(icon = icon("paint-brush"), title = "Tab 2", numericInput(inputId = "inputsidebar2", label = "Observations:", value = 10, min = 1, max = 100)))), footer = dashboardFooter(left = "By Divad Nojnarg", right = "Zurich, 2019"))
我使用的是 Windows 11 操作系统。我的R和R Studio版本如下:
R version 4.2.0 (2022-04-22 ucrt) -- "Vigorous Calisthenics"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
RStudio 2022.02.3+492 "Prairie Trillium" Release (1db809b8323ba0a87c148d16eb84efe39a8e7785, 2022-05-20) for Windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36
我真的很想使用shinydashboardPlus包来构建我的仪表板,但似乎无法开始使用它。
最佳答案
我在尝试访问图书馆的演示库时遇到了同样的问题。这显然是 shinydashboard
和 shinydashboardPlus
包之间的命名空间问题。如果执行以下行search()
:
> search()
[1] ".GlobalEnv" "package:shinyEffects" "package:styler"
[4] "package:shinyAce" "package:shinyWidgets" "package:shinydashboard"
[7] "package:shinyjqui" "package:shiny" "package:shinydashboardPlus"
[10] "tools:rstudio" "package:stats" "package:graphics"
[13] "package:grDevices" "package:utils" "package:datasets"
[16] "package:methods" "Autoloads" "org:r-lib"
[19] "package:base"
如您所见,在我的例子中,shinydashboard
包放置在 shinydashboardPlus
包之前,因此 dashboardPage
函数是使用的是属于 shinydashboard
包而不是 shinydashboardPlus
包的包。
这是一个错误,我的快速解决方案是:
- 找到演示应用程序所在的位置,您应该在类似于
~\Documents\R\R-4.1.2\library\shinydashboardPlus\examples
的路径中找到它。 - 打开
global.R
文件。 - 您必须更改顺序以确保
shinydashboardPlus
包在shinydashboard
包之后调用。
例如:
# Load packages
library(shiny)
library(shinyjqui)
library(shinyWidgets)
library(shinyAce)
library(styler)
library(shinyEffects)
library(shinydashboard)
library(shinydashboardPlus)
关于r - shinydashboardPlusGallery() 示例不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72675122/