I have a shinnyapp on https://www.shinyapps.io/ that I can normally deploy the app using the "publish" button.
However I want to use instead the deployApp
function as in the code bellow:
rsconnect::deployApp("~/Documents/R/shinny",appName="myapp", account="myaccount")
But when using the deployApp
function it gets an error on the web browser:
An error has occurred
The application failed to start: exited unexpectedly with code 1
Attaching package: ‘dplyr’
The following objects are masked from ‘package:plyr’:
arrange, count, desc, failwith, id, mutate, rename, summarise,
summarize
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
Error in value[[3L]](cond) : could not find function "dashboardPage"
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
So If push the button, no problem but if I use the function it goes wrong.
My Rscript structure is bellow ( there are more code inside the functions but I keep it simple to exemplify)
library(shinydashboard)
library(shiny)
library(ggplot2)
library(dplyr)
library(scales)
library(lubridate)
library(zoo)
library(reshape2)
library(scales)
library(ggrepel)
library(stringr)
load("sales.RData")
sidebar <- dashboardSidebar(
)
)
body <- dashboardBody(
)
ui <- fluidPage(dashboardPage(
dashboardHeader(),
sidebar,
body
)
)
server <- function(input, output) {
}
# Run the application
shinyApp(ui = ui, server = server)
rsconnect::deployApp('C:\\Users\\Repro\\Documents\\R\\SHINY',
appFiles = c('app.R','sales.RData','www/custom.css'),
account = 'myaccount', server = 'shinyapps.io')
What could be the problem ?
Thanks
library(shiny)
or ratherlibrary(shinydashboard)
at the head of your script ?rsconnect::deployApp()
directly without any parameters. Can you try this?