I test my application on my laptop and then deploy it to shinyapps server. Before deploying, I need to remove the instruction that sets the path, for example,
setwd('/Users/MrY/OneDrive/Data')
Is there a way that the code can find out if it works locally or on the server, so that would look like this:
if (isLocal()) {
setwd('/Users/MrY/OneDrive/Data')
}
A trivial code example (it will not work on the server if setwdit is not deleted):
server.R
library(shiny)
setwd('/Users/Yuji/OneDrive/Data/TownState')
data = 'data1.csv'
shinyServer(function(input, output) {
})
ui.R
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("Click the button"),
sidebarPanel(
actionButton("goButton", "Go!")
),
mainPanel(
)
))
source
share