【发布时间】:2015-06-29 21:43:10
【问题描述】:
我可以开发需要其他软件包的 R Shiny 应用吗?例如,
ui.R,
shinyServer(
pageWithSidebar(
headerPanel("Shiny App"),
sidebarPanel("side bar"),
mainPanel(
plotOutput("myPlot")
)
)
)
服务器.R,
shinyServer(
function(input, output, session) {
output$myPlot = renderPlot({
library("openair")
scatterPlot(selectByDate(mydata, year = 2003), x = "nox", y = "no2",
method = "density", col = "jet")
})
}
)
运行应用程序,
> runApp()
Listening on http://127.0.0.1:4459
Loading required package: lazyeval
Loading required package: dplyr
Attaching package: ‘dplyr’
The following object is masked from ‘package:stats’:
filter
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
Loading required package: maps
(loaded the KernSmooth namespace)
我在本地机器上得到这个结果,
但是当我尝试部署应用程序时,我在下面出现了这个错误,
> setwd("C:/.../myapp")
> library(shiny)
> library(shinyapps)
Attaching package: ‘shinyapps’
The following object is masked from ‘package:shiny’:
hr
> deployApp()
Preparing to deploy application...DONE
Uploading application bundle...
Error in setwd(bundleDir) : cannot change working directory
发生了什么事?这是否意味着我不能将本机 R 与其他包(例如 openair)集成/导入?
编辑:
> require(openair)
> deployApp()
Uploading application bundle...
Error in setwd(bundleDir) : cannot change working directory
【问题讨论】:
-
如果这是一个依赖问题,请参阅
?shinyapps::appDependencies。它可能会有所帮助。 -
?shinyapps::appDependencies在哪里? -
@teelou 只需在 R 中输入
?shinyapps::appDependencies。 -
@Pascal。谢谢,但我仍然遇到同样的错误。请看我上面的编辑。
-
您是否尝试以管理员身份运行 Rstudio?