我可以开发需要其他软件包的 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