weird error happen in show a dataframe in shiny

hello everyone
I meet with a weird error :thinking: :thinking: :thinking:
I made a shiny app. When I try to run my app in Rstudio my click the "Run App" button, everything is OK.
But when I try to run the same app deployed by the " DesktopDeployR" ,a weird error happen.
In my app, I want to show some plot and dataframe. the weird error is: one of the dataframe show wrong
value. my code is something like:

sum_table=matrix(NA,ncol=6,nrow=16)
##some calculation
ui <- pageWithSidebar(
mainPanel(
checkboxInput("checkbox", " Show Total result", value = F)
dataTableOutput("total")
))
server <- function(input, output,session) {
  output$total <- renderDataTable({
    req(input$checkbox)
    datatable(sum_table)
    })
}

I locally run the calculation step and the result is OK. But something wrong do occur when running the deployed app. the same table show the wrong value
I really don't know why :sob: :sob:
can anyone tell me what's wrong?

Is your calculation deterministic or does it involve random elements?

NO
my code is something like:
reading data from database ,and do some search and calculation.
No random value involved. and the right value in the "sum_month" is nearly 1 million. and the wrong value is around 10.
here is a brief look of my code.

sum_month=matrix(NA,ncol=14,nrow=32)
sum_month[,1]=my_product
colnames(sum_month)=c("product","type","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
sum_month[,2]=c(rep("realized",length(my_product)),rep("projection",length(my_product)))

for(i in my_product){
  tmp_input=read.csv(paste0(my_db_path,i,"_input.csv"),stringsAsFactors = F)
  for (j in 4:15){
    tmp_input[,j]=as.numeric(tmp_input[,j])
  }
  tmp_result=generate_table(i,tmp_input)
  sum_month[sum_month[,1]==i&sum_month[,2]=="realized",3:14]=tmp_result$bulk_out["aaa",]
  sum_month[sum_month[,1]==i&sum_month[,2]=="projection",3:14]=tmp_result$bulk_out["bbb",]

}

the code shared doesn't seem to access any database, rather its dependent on reading csv files.
So I would wonder if these are available in the same way to the desktop deployed version

1 Like

Thank you for your reply
yes, the shared code was only part of the whole app.

and only this part code show this error and get the wrong value.
Other part also use these csv data and it work fine. so the I think the desktop version can get access of these csv data.

Sorry, I don't think I could figure this out.
If I was debugging for myself I would make a minimal program maybe just to read and show the csvs alone and desktopdploy it. And add in additional features as I go, looking for any breaking feature.
I recommend version control like with git/github integration

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.