title: How to know if the app is running at local or on server? (R Shiny)
body: <p>I test my app on my laptop, and then deploy it to shinyapps server.
  Before deploying, I need to remove the statement setting the path, e.g., </p>
  
  <pre><code>setwd('/Users/MrY/OneDrive/Data')
  </code></pre>
  
  <p>Is there a way the code can find out if it's running locally or on server, so that it will be like:</p>
  
  <pre><code>if (isLocal()) {
         setwd('/Users/MrY/OneDrive/Data')
  }
  </code></pre>
  
  <hr>
  
  <p>A trivial sample code (it will fail on server if <code>setwd</code> isn't removed):</p>
  
  <p>server.R</p>
  
  <pre><code>library(shiny)
  
  setwd('/Users/Yuji/OneDrive/Data/TownState')  
  
  data = 'data1.csv'  # to test, using an empty .csv file
  
  shinyServer(function(input, output) {
  
  
  }) 
  </code></pre>
  
  <p>ui.R</p>
  
  <pre><code>library(shiny)
  
  shinyUI(pageWithSidebar(
      headerPanel("Click the button"),
  
      sidebarPanel(
          actionButton("goButton", "Go!")
      ),
      mainPanel(
  
      )
  ))
  </code></pre>