MicrobiomeStat icon indicating copy to clipboard operation
MicrobiomeStat copied to clipboard

time.var = NULL, in mStat_generate_report_single () causes an error and stops rendering

Open RachBioHaz opened this issue 6 months ago • 2 comments

Hi, I'm running into an issue with the mStat_generate_report_single() when I am using data without a time variable. Hoping you can help. Cheers Rachele

Describe the Bug

Trying to run the report without a time variable, but the report fails. If the time.var field = NULL in mStat_generate_report_single() , an error appears and the report stops rendering.

The error may be related to issue #15 - seems similar

Reproducible Example Using the data set code below generates the error

data(ecam.obj)

mStat_generate_report_single(
  data.obj = ecam.obj,
  dist.obj = NULL,
  alpha.obj = NULL,
  group.var = "delivery",
  vis.adj.vars = "diet",
  test.adj.vars = "diet",
  subject.var = "subject.id",
  time.var = NULL,
  alpha.name = c("shannon", "observed_species"),
  depth = NULL,
  dist.name = c("BC",'Jaccard'),
  t.level = NULL,
  feature.box.axis.transform = "sqrt",
  strata.var = "antiexposedall",
  vis.feature.level = c("Phylum", "Family", "Genus"),
  test.feature.level = "Family",
  feature.dat.type = "proportion",
  theme.choice = "bw",
  base.size = 20,
  feature.mt.method = "none",
  feature.sig.level = 0.2,
  output.file = "C:/Scratch/Testecam.obj_report.pdf"
)

Expected Behavior I expected the report to run either with NULL in the field or with it removed. The documentation does not make it clear what the options are.

Actual Behavior

The function will not run if it is removed ("argument "time.var" is missing, with no default"), and fails if NULL is used with the error message below:

processing file: file57fc6c274895.Rmd |.... | 4% [input-parameters-summary]
Quitting from lines 18-105 [input-parameters-summary] (file57fc6c274895.Rmd) Error in data.frame(): ! arguments imply differing number of rows: 34, 33 Backtrace:

  1. base::data.frame(...)

Screenshots Traceback: image

Environment Information:

sessionInfo() R version 4.3.2 (2023-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 11 x64 (build 22621)

Matrix products: default

locale: [1] LC_COLLATE=English_Australia.utf8 LC_CTYPE=English_Australia.utf8 LC_MONETARY=English_Australia.utf8 LC_NUMERIC=C
[5] LC_TIME=English_Australia.utf8

time zone: Australia/Sydney tzcode source: internal

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

loaded via a namespace (and not attached): [1] digest_0.6.33 styler_1.10.2 fastmap_1.1.1 xfun_0.41 magrittr_2.0.3 glue_1.6.2 R.utils_2.12.3
[8] knitr_1.45 htmltools_0.5.7 lifecycle_1.0.4 cli_3.6.1 R.methodsS3_1.8.2 vctrs_0.6.5 reprex_2.0.2
[15] data.table_1.14.10 withr_2.5.2 compiler_4.3.2 R.oo_1.25.0 R.cache_0.16.0 purrr_1.0.2 rstudioapi_0.15.0 [22] tools_4.3.2 clipr_0.8.0 rlang_1.1.2 fs_1.6.3 htmlwidgets_1.6.4

Additional Context Add any other context about the problem here, e.g., is this issue sporadic or consistent? Did it work in previous versions?

RachBioHaz avatar Dec 12 '23 15:12 RachBioHaz