使用传单部署 R shiny 应用程序

Deploying R shiny app using leaflet

我想使用我可以在线发布的传单创建一个闪亮的地图,让没有 R 的其他人可以查看它并与之交互。我可以使用传单创建一个闪亮的应用程序,但是当我在弹出窗口 window 中使用 'publish' 按钮时,我收到一条错误消息,提示“要部署的目录 (~) 超出了最大部署大小,即100MB。考虑创建一个仅包含您希望部署的内容的新目录。

我不明白这是在告诉我什么。有人有什么想法吗?我在下面发布了我的代码。

谢谢,休

    library(shiny)
    library(leaflet)

    shinyApp(
ui = fluidPage(leafletOutput('myMap')),
server = function(input, output) {

# download and load data
map = leaflet() %>% addTiles('http://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png',
                             attribution = paste(
                               '&copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors',
                               '&copy; <a href="http://cartodb.com/attributions">CartoDB</a>'
                             )
) %>% setView(-122.36, 47.67, zoom = 10)
output$myMap = renderLeaflet(map)
}
)    

我昨天(2015 年 5 月 14 日)从 RStudio 收到了这封电子邮件:

New in shinyapps.io May 2015 - Analyze bigger datasets! Larger R packages – shinyapps.io has increased the size of R packages that can be installed from 100MB to 1GB.

基本上 RStudio 将存储限制从 100 MB 增加到 1GB。也许这可以解决您的问题?

这是一种解决方法,但今天我自己部署应用程序时它对我有用:

当我尝试从 Rstudio 的标准 .R File 内部部署 shinyApp 时,我在单击 "Publish" 按钮时收到了与您相同的错误消息。 然而,当我将我的代码嵌入到块内的 Rmarkdown 文档中时,它突然开始工作了。

所以只需复制您的代码并打开一个新的 Rmarkdown 文件,单击 "Shiny Document" 并将您的代码粘贴到一个块中,然后删除除 Rmarkdown 文件的 header 以外的所有内容。现在,当您 运行 代码并单击 "Publish" 时,它应该可以工作。