我正在尝试在 ggplot 上制作热图。我有一个类似于下面的数据框
wday hour quant
Mon 0 1.2346944
Tue 0 0.8418860
Wed 0 0.8904375
Thu 0 0.8906767
Fri 0 1.0761553
Sat 0 2.1095617
Sun 0 2.1421696
Mon 1 2.9178615
Tue 1 0.7481875
Wed 1 0.6200556
Thu 1 0.5530000
Fri 1 0.3852611
Sat 1 0.4791192
Sun 1 1.0958043
Mon 2 2.8627222
Tue 2 0.7989769
Wed 2 0.4209105
Thu 2 0.6512810
Fri 2 0.5047176
Sat 2 0.6544059
Sun 2 0.8167846
Run Code Online (Sandbox Code Playgroud)
我的代码是:
ggplot(df , aes(x = hour, y = wday)) +
geom_raster(aes(fill …Run Code Online (Sandbox Code Playgroud) 我刚刚开始使用rintrojs包,我想将它与该shinydashboard包混合起来。我特别想采取以下步骤:
我尝试从他们的 github 页面上的示例开始,并在侧边栏上添加第六步,但它返回了一个错误
library(rintrojs)
library(shiny)
library(shinydashboard)
# Define UI for application that draws a histogram
ui <- shinyUI(
dashboardPage(
dashboardHeader(title = "Basic dashboard"),
introBox(dashboardSidebar(
),data.step = 6,
data.intro = 'This is the sidebar'),
dashboardBody(
fluidPage(
introjsUI(),
# Application title
introBox(
titlePanel("Old Faithful Geyser Data"),
data.step = 1,
data.intro = "This is the title panel"
),
# Sidebar with a slider input for number of bins
sidebarLayout(sidebarPanel(
introBox(
introBox(
sliderInput(
"bins",
"Number of …Run Code Online (Sandbox Code Playgroud) 我一直在尝试从包ShinyWidgets中制作带有子类别的pickerInput。
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
tags$h2("Select / Deselect all"),
pickerInput(
inputId = "p1",
label = "Select all option",
choices = list(subA = c("a","b","c"),
subB = c("a"),
subC = c("a","b")),
multiple = TRUE,
options = list(`actions-box` = TRUE)
),
verbatimTextOutput("r1")
)
server <- function(input, output, session) {
output$r1 <- renderPrint(input$p1)
}
shinyApp(ui = ui, server = server)
Run Code Online (Sandbox Code Playgroud)
问题是,当一个子类别只有一个元素时,输出有点奇怪,并且显示的内容与其他子类别不同。在我的示例中,我可以选择子类别的名称 (subB),但不能选择该子类别的元素 (“a”)
有没有办法来解决这个问题?