I try to build a shiny app. I wanted to start from scratch, therefore starting very basic. Now when I\'m trying to run my app, at first it seems to work, but instantly the a
You got your directories mixed up. If you run runApp()
in a separate R file where you include the directory that would fix your problem, as you just have to specify the name of the folder containing ui.r
and server.r
. To follow on your example below:
ui.R
library(shiny)
# Define UI for application that draws a histogram
shinyUI(fluidPage(
titlePanel("Test"),
sidebarLayout(
sidebarPanel("sidebar panel"),
mainPanel("Data")
)
))
server.R
library(shiny)
shinyServer(function(input, output) {})
Now those two are in the folder Test. Create another R file that only has the runApp()
function in it. This is handy if you want to run your shiny app from a separate file (or you can force it to use a port of your choosing), giving you more control.
Your Run file (you can call it whatever you want)
library(shiny)
setwd("C:/Users")
runApp("Test")
Here I saved the server.R
and the ui.R
in one folder Test, then I specified what directory that folder is in and ran the program, just by specifying the name of your shiny app.