insightsengineering / teal

Exploratory Web Apps for Analyzing Clinical Trial Data
https://insightsengineering.github.io/teal/
Other
176 stars 35 forks source link

<qenv.error: object 'data1' not found when evaluating qenv code: data1 <- as.data.frame(data1)>[Bug]: <title> #1215

Closed DishengHuang closed 4 months ago

DishengHuang commented 4 months ago

What happened?

When I read the xpt file (old version of CDISC) into R 4.4.0, and I get this error - <qenv.error: object 'data1' not found when evaluating qenv code: data1 <- as.data.frame(data1)>[Bug]: </p> <p>Here is my code: library(teal.modules.clinical) library(tern) library(dplyr) library(haven)</p> <p>adsl <- read_xpt("ADaM/adsl.xpt") adae <- read_xpt("ADaM/adae.xpt")</p> <p>data <- teal_data()</p> <p>data <- within(data, { adsl <- as.data.frame(adsl) adae <- as.data.frame(adae) } ) data</p> <h3>sessionInfo()</h3> <pre><code class="language-R">R version 4.4.0 (2024-04-24) Platform: x86_64-apple-darwin20 Running under: macOS Big Sur 11.3.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-x86_64/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] stats graphics grDevices utils datasets methods base other attached packages: [1] haven_2.5.4 dplyr_1.1.4 teal.modules.clinical_0.9.1 tern_0.9.4 [5] rtables_0.6.7 magrittr_2.0.3 formatters_0.5.6 teal.transform_0.5.0 [9] teal_0.15.2 teal.slice_0.5.1 shiny_1.8.1.1 teal.data_0.6.0 [13] teal.code_0.5.0 loaded via a namespace (and not attached): [1] utf8_1.2.4 generics_0.1.3 tidyr_1.3.1 tern.gee_0.1.3 lattice_0.22-6 hms_1.1.3 [7] digest_0.6.35 estimability_1.5 grid_4.4.0 mvtnorm_1.2-4 fastmap_1.1.1 Matrix_1.7-0 [13] backports_1.4.1 survival_3.5-8 promises_1.3.0 purrr_1.0.2 fansi_1.0.6 scales_1.3.0 [19] Rdpack_2.6 cli_3.6.2 rlang_1.1.3 rbibutils_2.2.16 munsell_0.5.1 splines_4.4.0 [25] geepack_1.3.10 tools_4.4.0 tzdb_0.4.0 checkmate_2.3.1 colorspace_2.1-0 ggplot2_3.5.1 [31] httpuv_1.6.15 forcats_1.0.0 broom_1.0.5 vctrs_0.6.5 logger_0.3.0 R6_2.5.1 [37] mime_0.12 emmeans_1.10.1 lifecycle_1.0.4 MASS_7.3-60.2 pkgconfig_2.0.3 teal.logger_0.2.0 [43] pillar_1.9.0 later_1.3.2 gtable_0.3.5 glue_1.7.0 Rcpp_1.0.12 tibble_3.2.1 [49] tidyselect_1.2.1 rstudioapi_0.16.0 xtable_1.8-4 nlme_3.1-164 htmltools_0.5.8.1 readr_2.1.5 [55] compiler_4.4.0</code></pre> <h3>Relevant log output</h3> <pre><code class="language-R">NA</code></pre> <h3>Code of Conduct</h3> <ul> <li>[X] I agree to follow this project's Code of Conduct.</li> </ul> <h3>Contribution Guidelines</h3> <ul> <li>[X] I agree to follow this project's Contribution Guidelines.</li> </ul> <h3>Security Policy</h3> <ul> <li>[X] I agree to follow this project's Security Policy.</li> </ul> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/m7pr"><img src="https://avatars.githubusercontent.com/u/133694481?v=4" />m7pr</a> commented <strong> 4 months ago</strong> </div> <div class="markdown-body"> <p>@DishengHuang does below code works??</p> <pre><code class="language-r">library(teal.modules.clinical) library(tern) library(dplyr) library(haven) data <- teal_data() data <- within(data, { adsl <- read_xpt("ADaM/adsl.xpt") adae <- read_xpt("ADaM/adae.xpt") adsl <- as.data.frame(adsl) adae <- as.data.frame(adae) } ) data</code></pre> <p>adsl and adae need to be created within <code>data</code> (<code>teal_data</code> object) so that they can be used. <code>teal_data</code> does not have an access to objects created in the <code>.GlobalEnv</code>.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/DishengHuang"><img src="https://avatars.githubusercontent.com/u/38817287?v=4" />DishengHuang</a> commented <strong> 4 months ago</strong> </div> <div class="markdown-body"> <p>Oh yes, this works for me. Thank you for the guidance</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>