STAT545-UBC / Discussion

Public discussion
37 stars 20 forks source link

Error in creating website #433

Open sinaneza opened 7 years ago

sinaneza commented 7 years ago

Dear Professor and Peers I have entirely finished my shiny app. The problem is that it does not create it as a website. it gives an error that I cant understand It says: "DataTables warning: table id=DataTables_Table_1 - Ajax error. For more information about this error, please see http://datatables.net/tn/7" PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

@jennybc @daattali

NicoleOngUBC commented 7 years ago

Provide details or send a personal email regarding your issue to the instructional team. I'm not sure that posting messages like you would on Facebook would give you the constructive response you need.

sinaneza commented 7 years ago

"DataTables warning: table id=DataTables_Table_1 - Ajax error. For more information about this error, please see http://datatables.net/tn/7" @supersonicole

samhinshaw commented 7 years ago

Well I hate to state the obvious, but if you go to that link there's a shockingly in-depth explanation on debugging your error! That being said, it's not specific to Shiny, so that's far less helpful.

The problem is that it does not create it as a website. it gives an error

Does this occur when you "Run App" and view in browser? Or only when you try to publish the app?

samhinshaw commented 7 years ago

@sinaneza I'm a bit confused, actually, because it works for me. https://samhinshaw.shinyapps.io/hw08_Shiny_App/

sinaneza commented 7 years ago

Really? Now after 10 times uploading, I was able to see it once entirely; but after that I attempted twice to open it again and I cant see my results completely again @samhinshaw

samhinshaw commented 7 years ago

Are you able to view my published copy properly, or does it give you the same error?

sinaneza commented 7 years ago

but the link that I have created is this: https://sinanezafatkhah.shinyapps.io/hw08_carbon_emission/ @samhinshaw

samhinshaw commented 7 years ago

I do not get an error message on that website. Can you post a screenshot of the error message?

Alternatively, do nothing, because it seems to be working for me 😅 It could be a browser error (a problem with your computer, not the actual app). But I am curious if your peer reviewers and graders will experience an error--it could be worthwhile to get to the bottom of this.

sinaneza commented 7 years ago

seems that its problem of Mozilla Firefox. because it works on other browsers. error

daattali commented 7 years ago

Just jumping in for a small comment: @sinaneza you may want to look into tabsetPanel in shiny. It lets you have different tabs so that instead of having one very long page you'll have a navigation at the top of the page that will let you get to different "pages" quickly

sinaneza commented 7 years ago

After Confirming and continuing, the final error is this: error_2

samhinshaw commented 7 years ago

I think this is an acceptable error for now. It may be occurring because you are loading so many things on one page, causing Firefox to hang. I would recommend you to put a note in your homework submission advising reviewers to not use Firefox.

Alternatively, Dean's fantastic advice may help alleviate this problem as well!

daattali commented 7 years ago

I doubt putting things in tabs will fix this, but it will at least make the app easier to navigate and use :)

Have you tried Googling for this problem? I always google for "r shiny ", this link came up on top: http://stackoverflow.com/questions/36266729/datatable-warning-table-ajax-error-for-some-people-but-not-all-with-shiny Take a look at that stackoverflow thread. The answer there also mentions that this bug has potentially been fixed in the dev version of DT - so if you install DT using devtools::install_github("rstudio/DT") instead of install.packages(), it might work

If you can't figure it out still, I agree with Sam that you can just make a note on your submission to not use firefox

sinaneza commented 7 years ago

@daattali Thanks alot Dean for your precious comments

sinaneza commented 7 years ago

@samhinshaw Thanks a lot Sam. Your comments were so helpful either

samhinshaw commented 7 years ago

Code from office hours:

ui <- fluidPage(
  titlePanel("Carbon Emission"),

  fluidRow(
    column(2),
    column(10, img(src = "Emission2.png",
               width = "600", heght = "600"))
  ),

  br(),br(), br(), br(), br(), br(), br(),
  tabsetPanel(id = "MainPageTabs", 
    tabPanel(
      title = "Sectors Trend for the whole world", 
      fluidRow(
        column(2),
        column(10,
               plotOutput("TotalSecTrPlot"),
               br(),br(),
               DT::dataTableOutput("TotalSecTrTable")
        )
      ),
      br(), br()
    ), 
    tabPanel(
      title = "Participation of Each Sector",
        sliderInput("ContinPoryearInput", "Year", 1950, 2013, 1982),
        plotOutput("ContinPorPlot"),
                  br(), br(),
                  DT::dataTableOutput("ContinPorTable"),
      br(),br()
  )
),
  h2("Trend of Sectors in Each Continent"),
sinaneza commented 7 years ago

Thanks alot Sam.

You are so helpful

samhinshaw commented 7 years ago

For issue with no default selected:

Option 1: Use levels(Continent_Emission$continent) rather than Continent_Emission$continent

 selectInput("ContinentSecTrInput", "Continent (Select Continent First)",
                levels(Continent_Emission$continent),
                selected = "Asia")

Option 2: Don't use selectize.js

 selectInput("ContinentSecTrInput", "Continent (Select Continent First)",
                Continent_Emission$continent,
                selected = "Asia",
                selectize = FALSE)