0

After I finish plot in r studio and try to publish my work to shiny io. R studio always shows this error message.

And this is my code for the graph:

install.packages("shiny")
library(shiny)

path ='C:/Users/rache/Downloads/r/shiny'
setwd(path)
data1=fread("category_table.csv")

head(data1)
ui <- fluidPage(

titlePanel("Histogram"),

sidebarLayout(

sidebarPanel( ),

mainPanel(

  plotOutput(outputId = "distPlot")

)
)
)

server <- function(input, output) {

  output$distPlot <- renderPlot({

     hist(data1$category_id, col = "#75AADB", border = "white",
     xlab = "number of parent product category",
     main = "Histogram of category product")
  })

}

shinyApp(ui, server)

I can plot in r studio, but I don't know why there is a problem for publish. Thank you for your help. I appreciate it.

this is the error msg:

deployApp() Error in lint(appDir, appFiles, appPrimaryDoc) : Cancelling deployment: invalid project layout. The project should have one of the following layouts: 1. 'shiny.R' and 'ui.R' in the application base directory, 2. 'shiny.R' and 'www/index.html' in the application base directory, 3. 'app.R' or a single-file Shiny .R file, 4. An R Markdown (.Rmd) document, 5. A static HTML (.html) or PDF (.pdf) document.

Rachel Y
  • 13
  • 3
  • 2
    It seems that `shinyapps` is not recognizing your file as a single-file Shiny App. My guess is that it's failing when trying to `fread()` a data file from a hard-coded absolute path. I recommend walking through [the tutorial of publishing a simple demo app](https://shiny.rstudio.com/articles/shinyapps.html). Once you have that working, take a look at [deploying shiny apps with local data](https://stackoverflow.com/questions/27793616/how-to-deploy-shiny-app-that-uses-local-data). – Artem Sokolov Feb 20 '18 at 21:52
  • Thank you for your reply. I checked the linked you mentioned. But my problem seems is a different issue. Thank you answer still~ – Rachel Y Feb 21 '18 at 01:44

0 Answers0