3

When I run my shinyapp, I have an error with plotly_build :

Error in plotly_build: argument "p" missing, with no default value

This is very strange because I didn't use the plotly_build function, and because the only item which is not displayed is a formattable. Actually, this is linked to my previous post (Reactive formattable in shiny?). When I used the code provided in the solution, it worked. But I tried to apply this code to my actual app, this error appeared. The strange thing is that after having tried in my actual app, I tried again in the solution provided and the same error appeared (whereas it was working fine before).

I know it is not easy to fix it without a reproducible example but maybe somebody already had this kind of problem. Here's my sessionInfo() :

R version 3.6.0 (2019-04-26)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
 [1] LC_CTYPE=fr_FR.UTF-8       LC_NUMERIC=C               LC_TIME=fr_FR.UTF-8        LC_COLLATE=fr_FR.UTF-8    
 [5] LC_MONETARY=fr_FR.UTF-8    LC_MESSAGES=fr_FR.UTF-8    LC_PAPER=fr_FR.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] WDI_2.6.0            easypackages_0.1.0   lmtest_0.9-37        zoo_1.8-6            usethis_1.5.0        devtools_2.0.2      
 [7] xtable_1.8-4         data.table_1.12.2    openxlsx_4.1.0.1     dplyr_0.8.2          broom_0.5.2          ECharts2Shiny_0.2.13
[13] factoextra_1.0.5     FactoMineR_1.41      plotly_4.9.0         ggplot2_3.2.0        formattable_0.2.0.1  shinydashboard_0.7.1
[19] plm_2.0-2            tseries_0.10-47      DT_0.7               haven_2.1.0          tidyselect_0.2.5     readxl_1.3.1        
[25] shiny_1.3.2         

loaded via a namespace (and not attached):
 [1] nlme_3.1-140         fs_1.3.1             xts_0.11-2           httr_1.4.0           rprojroot_1.3-2      tools_3.6.0         
 [7] backports_1.1.4      R6_2.4.0             lazyeval_0.2.2       colorspace_1.4-1     withr_2.1.2          prettyunits_1.0.2   
[13] processx_3.3.1       curl_3.3             compiler_3.6.0       cli_1.1.0            flashClust_1.01-2    desc_1.2.0          
[19] sandwich_2.5-1       labeling_0.3         scales_1.0.0         readr_1.3.1          quadprog_1.5-7       callr_3.2.0         
[25] stringr_1.4.0        digest_0.6.19        rmarkdown_1.13       pkgconfig_2.0.2      htmltools_0.3.6      sessioninfo_1.1.1   
[31] bibtex_0.4.2         htmlwidgets_1.3      rlang_0.4.0          TTR_0.23-4           rstudioapi_0.10      quantmod_0.4-15     
[37] generics_0.0.2       jsonlite_1.6         crosstalk_1.0.0      zip_2.0.2            magrittr_1.5         Formula_1.2-3       
[43] leaps_3.0            Rcpp_1.0.1           munsell_0.5.0        yaml_2.2.0           scatterplot3d_0.3-41 stringi_1.4.3       
[49] RJSONIO_1.3-1.2      gbRd_0.4-11          MASS_7.3-51.4        pkgbuild_1.0.3       grid_3.6.0           promises_1.0.1      
[55] ggrepel_0.8.1        bdsmatrix_1.3-3      forcats_0.4.0        crayon_1.3.4         lattice_0.20-38      hms_0.4.2           
[61] knitr_1.23           ps_1.3.0             pillar_1.4.2         pkgload_1.0.2        glue_1.3.1           evaluate_0.14       
[67] remotes_2.1.0        httpuv_1.5.1         Rdpack_0.11-0        miscTools_0.6-22     cellranger_1.1.0     gtable_0.3.0        
[73] purrr_0.3.2          tidyr_0.8.3          assertthat_0.2.1     xfun_0.8             mime_0.7             later_0.8.0         
[79] viridisLite_0.3.0    tibble_2.1.3         memoise_1.1.0        cluster_2.1.0        maxLik_1.3-6  

and my code for the table (not reproducible because this error does not appear in the reproducible example I provided in the link above) :

  lmod <- reactive({
    lm(as.formula(paste(input$v.dependent, "~", paste(input$predictor, collapse = "+"))), data = user.selection())
  })

  output$res.reg <- renderFormattable({
    tmp <- summary(lmod())$coefficients
    colnames(tmp) <- c("Coefficients", "SD", "t statistic", "Pvalue")
    tmp <- signif(x = tmp, digits = 3)
    tmp <- as.data.frame(tmp)
    tmp <- formattable(tmp, list(
      Pvalue = formatter("span", style = x ~ style(color = ifelse(x < 0.05, "red", "black"))))
    )
    tmp
  })

1 Answer 1

11

I finally found the solution. The error is due to the fact I use simultaneously the plotly and the formattable packages. The solution can be found here : Using formattable and plotly simultaneously

Applied to my problem, I just need to replace

formatter("span", style = x ~ style(color = ifelse(x < 0.05, "red", "black"))))

by

formatter("span", style = x ~ formattable::style(color = ifelse(x < 0.05, "red", "black"))))

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.