Can I develop a R Shiny app that requires other packages? For instance,
ui.R,
shinyServer(
pageWithSidebar(
headerPanel("Shiny App"),
sidebarPanel("side bar"),
mainPanel(
plotOutput("myPlot")
)
)
)
server.R,
shinyServer(
function(input, output, session) {
output$myPlot = renderPlot({
library("openair")
scatterPlot(selectByDate(mydata, year = 2003), x = "nox", y = "no2",
method = "density", col = "jet")
})
}
)
Run the app,
> 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)
I get this result on my local machine,
But when I try to deploy the app, I this this error below,
> 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
What is going on? Does it mean that I cannot integrate/ import the native R with other packages (for instance openair)?
EDIT:
> require(openair)
> deployApp()
Uploading application bundle...
Error in setwd(bundleDir) : cannot change working directory