-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Listing with 0 rows print output is an error #238
Comments
I think @BFalquet has a workaround ready for this in chevron, right? |
You can for instance use: library(rlistings)
result <- tibble::tibble(col1 = character(0L), col2 = character(0L), col3 = character(0L))
listing <- rlistings::as_listing(result)
chevron::report_null(listing)
#> ————————————————————————————————————————————————————————————————————————————————————————
#> Null Report: No observations met the reporting criteria for inclusion in this output. Created on 2025-01-05 with reprex v2.1.1 Feel free to add the issue on Overflow |
Thanks @BFalquet, that is solved locally just as I'm doing with @Melkiades I still think this issue on this repo is relevant here as the print method should:
|
hi @averissimo so the ask is to improve the print.listing_df function rlistings/R/rlistings_methods.R Line 17 in ceca6ef
such that we can perform a check on in this listing is empty, i.e. 0 rows, then it prints out something like and you do not want this to throw an error? or you do it want it throw an error that can be caught I incline to throw an error |
Summary
rlisitings
allows the creation of a listing with 0 rows, but with columns defined, however it gives an error when printing it.It would be nice to print an empty table or with "No data available." replacing the empty row's content (similar to {DT}).
Created on 2024-12-16 with reprex v2.1.1
R session info
R version 4.4.2 (2024-10-31) Platform: x86_64-pc-linux-gnu Running under: Ubuntu 24.04.1 LTS Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.12.0 LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0 locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_IE.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_IE.UTF-8 [6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_IE.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_IE.UTF-8 LC_IDENTIFICATION=C time zone: Europe/Lisbon tzcode source: system (glibc) attached base packages: [1] stats graphics grDevices datasets utils methods base other attached packages: [1] teal.modules.clinical_0.9.1.9040 dplyr_1.1.4 testthat_3.2.1.1 tern_0.9.6.9017 [5] rtables_0.6.10.9010 magrittr_2.0.3 formatters_0.5.9.9005 teal.transform_0.5.0.9016 [9] teal_0.15.2.9091 teal.slice_0.5.1.9016 teal.data_0.6.0.9021 teal.code_0.5.0.9020 [13] shiny_1.9.1 loaded via a namespace (and not attached): [1] rstudioapi_0.17.1 jsonlite_1.8.8 nestcolor_0.1.2.9017 estimability_1.5.1 farver_2.1.2 [6] rmarkdown_2.29 fs_1.6.4 geepack_1.3.12 ragg_1.3.2 vctrs_0.6.5 [11] memoise_2.0.1 askpass_1.2.0 htmltools_0.5.8.1 forcats_1.0.0 curl_5.2.3 [16] broom_1.0.7 sass_0.4.9 parallelly_1.37.1 bslib_0.7.0 htmlwidgets_1.6.4 [21] desc_1.4.3 fontawesome_0.5.2 emmeans_1.10.5 plotly_4.10.4 cachem_1.1.0 [26] uuid_1.2-0 TMB_1.9.15 mime_0.12 lifecycle_1.0.4 teal.widgets_0.4.2.9024 [31] pkgconfig_2.0.3 Matrix_1.7-1 R6_2.5.1 fastmap_1.2.0 rbibutils_2.2.16 [36] rlistings_0.2.9.9010 digest_0.6.35 colorspace_2.1-0 ps_1.7.6 shinycssloaders_1.0.0 [41] rprojroot_2.0.4 pkgload_1.4.0 textshaping_0.4.0 crosstalk_1.2.1 labeling_0.4.3 [46] fansi_1.0.6 httr_1.4.7 compiler_4.4.2 fontquiver_0.2.1 withr_3.0.2 [51] backports_1.5.0 logger_0.4.0 pkgbuild_1.4.4 MASS_7.3-61 openssl_2.2.0 [56] gfonts_0.2.0 tools_4.4.2 zip_2.3.1 httpuv_1.6.15 shinyvalidate_0.1.3 [61] clipr_0.8.0 glue_1.7.0 callr_3.7.6 nlme_3.1-166 promises_1.3.0 [66] mmrm_0.3.14.9001 grid_4.4.2 checkmate_2.3.2 rtables.officer_0.0.1.9008 generics_0.1.3 [71] gtable_0.3.5 tidyr_1.3.1 data.table_1.15.4 xml2_1.3.6 utf8_1.2.4 [76] ggrepel_0.9.6 pillar_1.9.0 later_1.3.2 splines_4.4.2 tern.gee_0.1.5.9004 [81] lattice_0.22-6 renv_1.0.5 survival_3.7-0 tidyselect_1.2.1 fontLiberation_0.1.0 [86] tern.mmrm_0.3.2.9002 knitr_1.49 fontBitstreamVera_0.1.1 teal.logger_0.3.0.9002 crul_1.4.2 [91] xfun_0.49 brio_1.1.5 DT_0.33 stringi_1.8.4 lazyeval_0.2.2 [96] yaml_2.3.8 httpcode_0.3.0 shinyWidgets_0.8.7 evaluate_0.23 officer_0.6.6 [101] gdtools_0.3.7 tibble_3.2.1 BiocManager_1.30.23 cli_3.6.2 xtable_1.8-4 [106] systemfonts_1.1.0 Rdpack_2.6 processx_3.8.4 munsell_0.5.1 jquerylib_0.1.4 [111] Rcpp_1.0.12 teal.reporter_0.3.1.9018 vistime_1.2.4 parallel_4.4.2 ggplot2_3.5.1 [116] assertthat_0.2.1 reprex_2.1.1 viridisLite_0.4.2 mvtnorm_1.2-5 scales_1.3.0 [121] purrr_1.0.2 crayon_1.5.2 flextable_0.9.6 rlang_1.1.3 cowplot_1.1.3 [126] shinyjs_2.1.0
OS / Environment
The text was updated successfully, but these errors were encountered: