Shiny Publishing Error :(

shinyappsio

#1

Hello!

When I try to publish my Shiny app to "shinyapps.io" I get the following error message: "path should be to files within the project directory"

Any ideas what I'm doing wrong? I have the file saved as app.r

Here is my code (note that "df" is a 512x66 dataframe that is uploaded into my session):

library(shiny)
#Input Functions
ui <- fluidPage(
  titlePanel("Library Program Feedback"),
  
  selectInput(inputId = "what", label = "What Day of the Week?",
              choices = c("Monday Morning", "Monday Afternoon", "Monday Evening", 
                          "Tuesday Morning", "Tuesday Afternoon", "Tuesday Evening",
                          "Wednesday Morning", "Wednesday Afternoon", "Wednesday Evening",
                          "Thursday Morning", "Thursday Afternoon", "Thursday Evening",
                          "Friday Morning", "Friday Afternoon", "Friday Evening",
                          "Saturday Morning", "Saturday Afternoon", "Sunday")),
  
  selectInput(inputId = "how", label = "How Did You Hear?", 
              choices = c("Facebook","Word of Mouth","Library Website","Newspaper","In-house Marketing","Other")),
  
  selectInput(inputId = "attended", label = "Program Attended", 
              choices = c("Movies", "Lecture", "Workshop", "Large Event", "Book Club", 
                          "Speaker/Performer", "Arts/Crafts", "Storytime", "STEAM")),
  
  selectInput(inputId = "active_passive", label = "Active/Passive",
              choices = c("Adult Active", "Adult Passive", "Children's Active", "Children's Passive")),
  
  selectInput(inputId = "adult_childrens", label = "Adult/Children's", 
              choices = c("Adult", "Children's")),
  
  tableOutput("table")
  
)
#Output Functions
server <- function(input, output) {
  output$table <- renderTable(df)
 
  
}

#Knit Componets Together
shinyApp(ui = ui, server = server)

#2

I was able to publish that same application without any trouble to shinyapps.io. Do you have any other files in the directory?

Also, do you have the latest version of the rsconnect package? It's currently at 0.8.12.

One more note: when I publish that app, the application log says:

Warning: Error in as.data.frame.default: cannot coerce class ‘"function"’ to a data.frame

This is because this application doesn't define the df object.


#3

I'm using my desktop as my working directory, so there are other files. But I only select my R file when I try to publish.

I just updated my rsconnect package to no avail.

A new R Script called "SessionPackages.R" appears when I try to publish, and it points to the following LAST 2 LINES of code as the error message:

# delegate to the system tar binary specified in TAR. On OS X, R may set TAR to
# /usr/bin/gnutar, which exists prior to Mavericks (10.9) but not in later
# rleases of the OS. In the special case wherein the TAR environment variable
# on OS X is set to a non-existant gnutar and there exists a tar at
# /usr/bin/tar, tell R to use that binary instead.
if (identical(as.character(Sys.info()["sysname"]), "Darwin") &&
    identical(Sys.getenv("TAR"), "/usr/bin/gnutar") && 
    !file.exists("/usr/bin/gnutar") &&
    file.exists("/usr/bin/tar"))
{
   Sys.setenv(TAR = "/usr/bin/tar")
```

#4

It will try to publish all the files in the directory where your app.R resides, so that is likely your problem. I suggest putting your app file in a separate directory and then deploy it from there.


#5

I have isolated the file pathway, and everything seemed like it was working, until I got this new error message :frowning:

rsconnect 0.8.12 is selected as a package in my library. And I don't have "install.packages("rsconnect") in my script.

Warning in install.packages("rsconnect") :
  'lib = "/opt/R/3.4.4/lib/R/library"' is not writable
Error in value[[3L]](cond) : unable to install packages
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted

#6

Is that the message that is displayed in the Deploy pane in RStudio?

And just to be clear, are you saying that you put your app.R in its own directory, with nothing else there?