Entering edit mode
                    Hi,
I was creating a R markdown for my DSP data analysis. When I ran addPerROIQC, I've got an error
Error in
addPerROIQC(): ! ncol(spe) > 0 is not TRUE
# Here is my code in my R markdown file.
spe <- addPerROIQC(spe, rm_genes = TRUE, min_count = 10)
# Full error messages are attached below
processing file: GeoMx_best_practice.Rmd
Error in `addPerROIQC()`:
! ncol(spe) > 0 is not TRUE
Backtrace:
  1. rmarkdown::render(...)
  2. knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
  3. knitr:::process_file(text, output)
  6. knitr:::process_group(group)
  7. knitr:::call_block(x)
     ...
 14. base::withRestarts(...)
 15. base (local) withRestartList(expr, restarts)
 16. base (local) withOneRestart(withRestartList(expr, restarts[-nr]), restarts[[nr]])
 17. base (local) docall(restart$handler, restartArgs)
 19. evaluate (local) fun(base::quote(`<smplErrr>`))
sessionInfo( )
R version 4.4.2 (2024-10-31)
Platform: aarch64-apple-darwin20
Running under: macOS Sonoma 14.7.1
Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/New_York
tzcode source: internal
attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods   base     
other attached packages:
 [1] knitr_1.49                  cowplot_1.1.3               rstatix_0.7.2               ggpubr_0.6.0                patchwork_1.3.0            
 [6] openxlsx_4.2.7.1            ggalluvial_0.12.5           msigdb_1.14.0               GSEABase_1.68.0             graph_1.84.0               
[11] annotate_1.84.0             XML_3.99-0.17               AnnotationDbi_1.68.0        vissE_1.14.0                lubridate_1.9.3            
[16] forcats_1.0.0               stringr_1.5.1               dplyr_1.1.4                 purrr_1.0.2                 readr_2.1.5                
[21] tidyr_1.3.1                 tibble_3.2.1                ggplot2_3.5.1               tidyverse_2.0.0             edgeR_4.4.0                
[26] limma_3.62.1                SpatialExperiment_1.16.0    SingleCellExperiment_1.28.1 SummarizedExperiment_1.36.0 Biobase_2.66.0             
[31] GenomicRanges_1.58.0        GenomeInfoDb_1.42.0         IRanges_2.40.0              S4Vectors_0.44.0            BiocGenerics_0.52.0        
[36] MatrixGenerics_1.18.0       matrixStats_1.4.1           standR_1.10.0              
loaded via a namespace (and not attached):
 [1] DBI_1.2.3               rlang_1.1.4             magrittr_2.0.3          compiler_4.4.2          RSQLite_2.3.8           png_0.1-8              
 [7] vctrs_0.6.5             pkgconfig_2.0.3         crayon_1.5.3            fastmap_1.2.0           backports_1.5.0         magick_2.8.5           
[13] XVector_0.46.0          utf8_1.2.4              rmarkdown_2.29          tzdb_0.4.0              UCSC.utils_1.2.0        bit_4.5.0              
[19] xfun_0.49               zlibbioc_1.52.0         cachem_1.1.0            jsonlite_1.8.9          blob_1.2.4              DelayedArray_0.32.0    
[25] broom_1.0.7             R6_2.5.1                stringi_1.8.4           car_3.1-3               Rcpp_1.0.13-1           Matrix_1.7-1           
[31] igraph_2.1.1            timechange_0.3.0        tidyselect_1.2.1        rstudioapi_0.17.1       abind_1.4-8             yaml_2.3.10            
[37] lattice_0.22-6          withr_3.0.2             KEGGREST_1.46.0         evaluate_1.0.1          zip_2.3.1               Biostrings_2.74.0      
[43] pillar_1.9.0            carData_3.0-5           generics_0.1.3          hms_1.1.3               munsell_0.5.1           scales_1.3.0           
[49] xtable_1.8-4            glue_1.8.0              tools_4.4.2             locfit_1.5-9.10         ggsignif_0.6.4          grid_4.4.2             
[55] colorspace_2.1-1        GenomeInfoDbData_1.2.13 Formula_1.2-5           cli_3.6.3               fansi_1.0.6             S4Arrays_1.6.0         
[61] gtable_0.3.6            digest_0.6.37           SparseArray_1.6.0       rjson_0.2.23            farver_2.1.2            memoise_2.0.1          
[67] htmltools_0.5.8.1       lifecycle_1.0.4         httr_1.4.7              statmod_1.5.0           bit64_4.5.2
I did not get this error message when I ran addPerROIQC in a regular Rscript.
Best, Joon

Just covering all bases. You defined spe earlier in the R markdown that is not shown?
Yes, I did. Here is my code.
I've got the error message when I run 'Knit to HTML or Knit to PDF'.
Hi, what's the output from
dim(spe)?That's odd. So it can run successfully within markdown but would be failed when knitting?