我已经构建了一个闪亮的网络应用程序,我想与我的同事分享。
我使用的其中runApp(host = getOption("shiny.host", "10.161.112.8"))10.161.112.8 是我的主机服务器 IP 地址。
该应用程序在我的本地服务器上完美运行,但某些远程客户端(不是全部!)直接显示灰屏(或最多 1 秒后)。在检查他们的网页源代码时,我收到以下错误:
Run Code Online (Sandbox Code Playgroud)Uncaught TypeError: Cannot read property 'readyState' of null at ShinyApp.$sendMsg (shinyapp.js:288) at ShinyApp.sendInput (shinyapp.js:140) at InputBatchSender.$sendNow (input_rate.js:220)
我在这里红色它可能与网络套接字限制有关。但我没有找到任何适合我的解决方案......
有人有什么建议吗?任何帮助将非常感激!
我创建了一个R Shiny应用程序,该程序每天使用批处理文件自动运行。启动应用程序时,一切正常,但第二天崩溃,我收到以下消息:
Warning in file(open = "w+") :
cannot open file
'C:\Users\bertin\AppData\Local\Temp\RtmpKiBPOU\Rf3f835d1a66' : No such file or directory
Warning: Error in file: cannot open the connection
[No stack trace available]
Run Code Online (Sandbox Code Playgroud)
实际上,此问题与tempdir()由执行闪亮应用程序的R会话创建的文件夹有关。一定时间后,此文件夹将自动删除。每次刷新时都必须删除所有Temp文件吗?还是相反,是否需要防止R删除Temp文件夹上的所有闪亮的临时文件?谢谢!
编辑 -这是有意产生错误的方法:
tempdir()
dir.exists(tempdir())
library(shiny)
# Windows shell required
shinyApp(
ui = fluidPage("Please reload to see me fail."),
server = function(input, output) {
shell(paste("rmdir", dQuote(
normalizePath(tempdir(), winslash = "/", mustWork = FALSE), q = FALSE
), "/s /q"))
}
)
Run Code Online (Sandbox Code Playgroud)
有人知道如何将 actionButton (R Shiny) 重置为初始值以便多次使用它吗?
请在下面找到一个可复制的示例:
在这个例子中,我想通过选择相应的按钮来更改图表颜色:我的问题是它无法在一次迭代后重新加载图表。
library(shiny)
ui <- fluidPage(
actionButton(inputId = "button1",label = "Select red"),
actionButton(inputId = "button2",label = "Select blue"),
plotOutput("distPlot")
)
server <- function(input, output) {
output$distPlot <- renderPlot({
x <- faithful[, 2]
bins <- seq(min(x), max(x))
my_color <- "green"
if (input$button1){my_color <- "red"}
if (input$button2){my_color <- "blue"}
hist(x, breaks = bins, col = my_color)
})
}
shinyApp(ui = ui, server = server)
Run Code Online (Sandbox Code Playgroud)
先感谢您
在A R降价文件,没有人知道为什么out.width,out.height,figure.width并figure.height产生一个PDF文件时参数不plotly改变图表的大小?(我确切地说这些参数可以完美地使用plot函数)
请在下面找到带有 Rmarkdown 文件的可复制示例
在这个例子中,我希望 plotly 图表像 plot 图表一样占据整个工作表。
---
title: "Change chart size chart on pdf file using plotly"
output:
pdf_document: default
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(echo=FALSE,message=FALSE)
```
## Parameters doesn't work with plotly
```{r, out.width='100%',out.height='100%',fig.height=20, fig.width=15, fig.align="left"}
library(plotly)
plot_ly(x = cars[1:10,]$speed,y = cars[1:10,]$dist)
```
## Parameters works using plot function
```{r,out.width='130%',out.height='100%', fig.height=20, fig.width=15, fig.align="left"}
plot(cars[1:10,])
```
Run Code Online (Sandbox Code Playgroud)
这是一种创建依赖于闪亮子项选择的闪亮观察事件的方法吗?
在下面的可重现示例中,我想在单击子菜单 1 时自动执行按钮 1,并在单击子菜单 2 时自动执行按钮 3。
library(shinydashboard)
library(shiny)
ui <- dashboardPage(
dashboardHeader(title = "Dynamic sidebar"),
dashboardSidebar(
sidebarMenuOutput("menu")
),
dashboardBody(heigth = 800, tabItems(
tabItem(tabName = "submenu_1",
fluidRow(
actionButton(inputId = "button_1",label = "Button 1", icon = icon("fa"),width = '417px'),
actionButton(inputId = "button_2",label = "Button 2", icon = icon("fa"),width = '417px')
)
),
tabItem(tabName = "submenu_2",
fluidRow(
actionButton(inputId = "button_3",label = "Button 3", icon = icon("fa"),width = '417px'),
actionButton(inputId = "button_4",label = "Button 4", icon = icon("fa"),width = '417px')
)
) …Run Code Online (Sandbox Code Playgroud) 我想在 R闪亮应用程序中为不在www文件夹中的 PDF 创建 pdf 查看器。
在下面的代码中,如果my_path没有引用 www 文件夹,则它似乎不起作用。
library(shiny)
ui <- fluidPage(
uiOutput("PDF_WINDOW")
)
server <- function(input, output, session) {
output$PDF_WINDOW <- renderUI({
tags$iframe(style="height:485px; width:100%", src= my_path)
})
}
shinyApp(ui, server)
Run Code Online (Sandbox Code Playgroud)
感谢您的任何建议
有人知道如何在选中闪亮按钮时突出显示边框或颜色吗?
请在下面找到可复制的示例
library(shiny)
ui <- fluidPage(
actionButton(inputId = "button1", label = "Select red"),
actionButton(inputId = "button2", label = "Select blue"),
plotOutput("distPlot")
)
server <- function(input, output) {
r <- reactiveValues(my_color = "green")
output$distPlot <- renderPlot({
x <- faithful[, 2]
bins <- seq(min(x), max(x))
hist(x, breaks = bins, col = r$my_color)
})
observeEvent(input$button1, {
r$my_color <- "red"
})
observeEvent(input$button2, {
r$my_color <- "blue"
})
}
shinyApp(ui = ui, server = server)
Run Code Online (Sandbox Code Playgroud)
这是上面代码的结果:
这是我想在选择“选择红色”按钮时得到的结果(请注意,选择时它应该突出显示另一个):
如果这是不可能的,是否存在在选择时更改按钮颜色的方法?
提前致谢
r ×7
shiny ×6
button ×1
connection ×1
events ×1
highlighting ×1
iframe ×1
knitr ×1
pdf ×1
r-markdown ×1
r-plotly ×1
readystate ×1
shinyapps ×1
shinyjs ×1
src ×1
submenu ×1
temp ×1