Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

R - TEAL on Local Machine (Error)#1086

BhargavAchanta started this conversation inGeneral
Discussion options

I am using the following code to test on Rstudio on my local machine, but the get the following error

library(teal)
library(shiny)
app <- init(
data = teal_data(
dataset("iris",iris),
dataset("mtcars",mtcars)
)
,
modules = list(
module(
label = "My",
ui = function(id){
tags$div("Hello")
}
)
)
)

shinyApp(app$ui,app$server)

Error:
!to_relational_data() was deprecated in teal.data 0.4.0 and is now defunct.
ℹ Find more information on#945

Backtrace:

  1. └─teal::init(...)
  2. └─teal.data::to_relational_data(data = data)
  3. └─teal.data:::.deprecate_function("to_relational_data()", deprecation_detail)
  4.   └─lifecycle::deprecate_stop(when = "0.4.0", what = what, details = details)
  5.     └─lifecycle:::deprecate_stop0(msg)

Run rlang::last_trace(drop = FALSE) to see 1 hidden frame.

You must be logged in to vote

Replies: 5 comments 8 replies

Comment options

Hi@BhargavAchanta

Can I see sessionInfo()?
We're in the middle of releasing teal frameworks, some are already released but some are still in process.
Because of this, you may need to install some packages (like teal.slice and teal) frommain instead of latest release.

If it's easier, you can wait until next week when we're done releasing everything.

You must be logged in to vote
5 replies
@BhargavAchanta
Comment options

Here is the session info details. Thank you!

Capture

@donyunardi
Comment options

As I suspected, you are using the latest release ofteal andteal.slice, you will need to install frommain branch for these two packages.

install.packages("teal.slice",repos= c("https://insightsengineering.r-universe.dev", getOption("repos")))install.packages("teal",repos= c("https://insightsengineering.r-universe.dev", getOption("repos")))

And, you have to use the new way to define teal.data as@chlebowa has pointed out on different comment.

@BhargavAchanta
Comment options

Hi Donny,

i have tried this as well and have the same error

install.packages("teal.slice", repos = c("https://insightsengineering.r-universe.dev", getOption("repos")))install.packages("teal", repos = c("https://insightsengineering.r-universe.dev", getOption("repos")))library(teal)library(shiny)app <- init(  data = teal_data(    "iris" = iris,    "mtcars" = mtcars  ),  modules = list(    module(      label = "My",      ui = function(id) {        tags$div("Hello")      }    )  ))shinyApp(app$ui,app$server)R version 4.3.2 (2023-10-31 ucrt) -- "Eye Holes"Copyright (C) 2023 The R Foundation for Statistical ComputingPlatform: x86_64-w64-mingw32/x64 (64-bit)R is free software and comes with ABSOLUTELY NO WARRANTY.You are welcome to redistribute it under certain conditions.Type 'license()' or 'licence()' for distribution details.  Natural language support but running in an English localeR is a collaborative project with many contributors.Type 'contributors()' for more information and'citation()' on how to cite R or R packages in publications.Type 'demo()' for some demos, 'help()' for on-line help, or'help.start()' for an HTML browser interface to help.Type 'q()' to quit R.> install.packages("teal.slice", repos = c("https://insightsengineering.r-universe.dev", getOption("repos")))WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:https://cran.rstudio.com/bin/windows/Rtools/Installing package into ‘C:/Users/BhargavAchanta/AppData/Local/R/win-library/4.3’(as ‘lib’ is unspecified)  There is a binary version available but the source version is later:           binary source needs_compilationteal.slice  0.4.0  0.5.0             FALSEinstalling the source package ‘teal.slice’trying URL 'https://cran.rstudio.com/src/contrib/teal.slice_0.5.0.tar.gz'Content type 'application/x-gzip' length 1314592 bytes (1.3 MB)downloaded 1.3 MB* installing *source* package 'teal.slice' ...** package 'teal.slice' successfully unpacked and MD5 sums checked** using staged installation** R** inst** byte-compile and prepare package for lazy loading** help*** installing help indices*** copying figures** building package indices** installing vignettes** testing if installed package can be loaded from temporary location** testing if installed package can be loaded from final location** testing if installed package keeps a record of temporary installation path* DONE (teal.slice)The downloaded source packages are in‘C:\Users\BhargavAchanta\AppData\Local\Temp\RtmpCYEn1D\downloaded_packages’> install.packages("teal", repos = c("https://insightsengineering.r-universe.dev", getOption("repos")))WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:https://cran.rstudio.com/bin/windows/Rtools/Installing package into ‘C:/Users/BhargavAchanta/AppData/Local/R/win-library/4.3’(as ‘lib’ is unspecified)trying URL 'https://insightsengineering.r-universe.dev/bin/windows/contrib/4.3/teal_0.14.0.zip'Content type 'application/zip' length 1312999 bytes (1.3 MB)downloaded 1.3 MBpackage ‘teal’ successfully unpacked and MD5 sums checkedThe downloaded binary packages are inC:\Users\BhargavAchanta\AppData\Local\Temp\RtmpCYEn1D\downloaded_packages> > > library(teal)Loading required package: shinyLoading required package: teal.dataLoading required package: teal.codeLoading required package: teal.sliceLoading required package: teal.transformLoading required package: magrittrYou are using teal version 0.14.0Attaching package: ‘teal’The following objects are masked from ‘package:teal.slice’:    as.teal_slices, teal_slicesThe following object is masked from ‘package:teal.data’:    get_join_keys> library(shiny)> > app <- init(+   data = teal_data(+     "iris" = iris,+     "mtcars" = mtcars+   ),+   modules = list(+     module(+       label = "My",+       ui = function(id) {+         tags$div("Hello")+       }+     )+   )+ )Error:! `to_relational_data()` was deprecated in teal.data 0.4.0 and is now defunct.ℹ Find more information on https://github.com/insightsengineering/teal/discussions/945Run `rlang::last_trace()` to see where the error occurred.> rlang::last_trace()<error/lifecycle_error_deprecated>Error:! `to_relational_data()` was deprecated in teal.data 0.4.0 and is now defunct.ℹ Find more information on https://github.com/insightsengineering/teal/discussions/945---Backtrace:    ▆ 1. └─teal::init(...) 2.   └─teal.data::to_relational_data(data = data) 3.     └─teal.data:::.deprecate_function("to_relational_data()", deprecation_detail) 4.       └─lifecycle::deprecate_stop(when = "0.4.0", what = what, details = details) 5.         └─lifecycle:::deprecate_stop0(msg)Run rlang::last_trace(drop = FALSE) to see 1 hidden frame.
@donyunardi
Comment options

Apologies, I gave the wrong URL to get themain branch of teal.
Yourteal.slice version is correct.

Can you please reinstallteal again using this code:

install.packages("teal", repos = c("https://pharmaverse.r-universe.dev", getOption("repos")))

and try it out again?

@BhargavAchanta
Comment options

Perfect. Works now. Thank you so much to you and to your team for your awesome work and presentations on TEAL package.

Comment options

Hi@BhargavAchanta

Try this:

app <- init(  data = teal_data(    "iris" = iris,    "mtcars" = mtcars  ),  modules = list(    module(      label = "My",      ui = function(id) {        tags$div("Hello")      }    )  ))
You must be logged in to vote
1 reply
@BhargavAchanta
Comment options

Hello, I have tried the code you provided , I have the same error.

Thank you

Comment options

Hello,using the following code to reproduce in locol machine but i see thiserror. [INFO] 2024-02-07 13:09:26.8288 pid:22628 token:[] teal.modules.clinicalInitializing tm_t_eventsError in choices_selected(c("ARM", "ARMCD"), "ARM") : could not find function "choices_selected"adsl <- tmc_ex_adsladae <- tmc_ex_adaeapp <- teal::init( data = cdisc_data("ADSL" = adsl, "ADAE" = adae ), modules = modules( tm_t_events( label = "Adverse Event Table", dataname = "ADAE", arm_var = choices_selected(c("ARM", "ARMCD"), "ARM"), llt = choices_selected( choices = variable_choices(adae, c("AETERM", "AEDECOD")), selected = c("AEDECOD") ), hlt = choices_selected( choices = variable_choices(adae, c("AEBODSYS", "AESOC")), selected = "AEBODSYS" ), add_total = TRUE, event_type = "adverse event" ) ))if (interactive()) { shinyApp(app$ui, app$server)}
On Tue, Feb 6, 2024 at 11:01 AM Dony Unardi ***@***.***> wrote: Apologies, I gave the wrong URL to get the main branch of teal. Your teal.slice version is correct. Can you please reinstall teal again using this code: install.packages("teal", repos = c("https://pharmaverse.r-universe.dev", getOption("repos"))) and try it out again? — Reply to this email directly, view it on GitHub <#1086 (reply in thread)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/BFYKYFRLRDW2JAI7OYSA7J3YSJ4YDAVCNFSM6AAAAABCXN3YUKVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DGOBWG44DC> . You are receiving this because you were mentioned.Message ID: ***@***.*** com>
You must be logged in to vote
1 reply
@donyunardi
Comment options

Can you make sure that you have teal.transform and tmc frommain?

install.packages("teal",repos= c("https://pharmaverse.r-universe.dev", getOption("repos")))install.packages("teal.modules.clinical",repos= c("https://pharmaverse.r-universe.dev", getOption("repos")))

Again, apologies for this, we're in the middle of the release.

Comment options

I will wait until the release. I have been having issues with running allthe example code on the local machine.. sometimes the shiny app appears andcloses immediately and some errors due to functions being deprecated . Theydo run fine without any issues on the TEAL playground on posit cloud. I aminstalling from main.Thanks
On Wed, Feb 7, 2024 at 2:30 PM Dony Unardi ***@***.***> wrote: Can you make sure that you're installing teal.transform and tmc from main? install.packages("teal", repos = c("https://pharmaverse.r-universe.dev", getOption("repos"))) install.packages("teal.modules.clinical", repos = c("https://pharmaverse.r-universe.dev", getOption("repos"))) Again, apologies for this, we're in the middle of the release. — Reply to this email directly, view it on GitHub <#1086 (reply in thread)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/BFYKYFRVZRR2J5SG4SDBASTYSP6BRAVCNFSM6AAAAABCXN3YUKVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DIMBQG4YTC> . You are receiving this because you were mentioned.Message ID: ***@***.*** com>
You must be logged in to vote
1 reply
@averissimo
Comment options

Apologies that you are experiencing this. Although we are keeping a migration path for the old data APIs, the whole {teal} environment needs to use the CRAN releases(or development/main for those that are not yet on CRAN).

As@donyunardi suggested, installing packages from thepharmaverse.r-universe.dev repository should allow you to run that{teal} application and other examples without issues.

I use the following snippet to make sure that my whole teal environment is up-to-date with development packages.

c("teal","teal.data","teal.code","teal.slice","teal.logger","teal.widgets","teal.reporter","teal.transform","teal.modules.general","teal.modules.clinical","rtables","tern")|> install.packages(repos= c(pharmaverse="https://pharmaverse.r-universe.dev",    getOption("repos")  ))

With this and the code snippet you shared above, I can run locally the{teal} application(added just 1 library call)

All the examples imply that you are loading{teal.modules.clinical} so it is fundamental as it will, in turn, load thechoices_selected andvariable_choices from{teal.transform}.

library(teal.modules.clinical)adsl<-tmc_ex_adsladae<-tmc_ex_adaeapp<-teal::init(data= cdisc_data("ADSL"=adsl,"ADAE"=adae  ),modules= modules(    tm_t_events(label="Adverse Event Table",dataname="ADAE",arm_var= choices_selected(c("ARM","ARMCD"),"ARM"),llt= choices_selected(choices= variable_choices(adae, c("AETERM","AEDECOD")),selected= c("AEDECOD")      ),hlt= choices_selected(choices= variable_choices(adae, c("AEBODSYS","AESOC")),selected="AEBODSYS"      ),add_total=TRUE,event_type="adverse event"    )  ))if (interactive()) {  shinyApp(app$ui,app$server)}

image

Comment options

Thank you. runs fine without errors, but i do see the following and theshinyapp flashes for a sec and closes immediately., not sure why..Listening onhttp://127.0.0.1:3038[INFO] 2024-02-08 07:44:58.3513pid:27528 token:[90831486] teal Initializingreporter_previewer_moduleWarning: Error in add_card_button_srv:Assertion on 'names(formals(card_fun))' failed: Must be a subset of{'card','comment'}, but has additional elements {'label'}. 3: runApp 2: print.shiny.appobj 1: <Anonymous>
On Thu, Feb 8, 2024 at 4:42 AM André Veríssimo ***@***.***> wrote: Apologies that you are experiencing this. Although we are keeping a migration path for the old data APIs, the whole {teal} environment needs to use the CRAN releases *(or development/main for those that are not yet on CRAN)*. As@donyunardi <https://github.com/donyunardi> said, installing all the packages from the pharmaverse.r-universe.dev repository should allow you to run that {teal} application and other examples without issues. I use the following snippet to make sure that my whole teal environment is up-to-date with development packages. c( "teal", "teal.data", "teal.code", "teal.slice", "teal.logger", "teal.widgets", "teal.reporter", "teal.transform", "teal.modules.general", "teal.modules.clinical", "rtables", "tern" ) |> install.packages( repos = c( pharmaverse = "https://pharmaverse.r-universe.dev", getOption("repos") ) ) With this and the code snippet you shared above, I can run locally the {teal} application *(added just 1 library call)* All the examples imply that you are loading {teal.modules.clinical} so it is fundamental as it will, in turn, load the choices_selected and variable_choices from {teal.transform}. library(teal.modules.clinical) adsl <- tmc_ex_adsladae <- tmc_ex_adae app <- teal::init( data = cdisc_data("ADSL" = adsl, "ADAE" = adae ), modules = modules( tm_t_events( label = "Adverse Event Table", dataname = "ADAE", arm_var = choices_selected(c("ARM", "ARMCD"), "ARM"), llt = choices_selected( choices = variable_choices(adae, c("AETERM", "AEDECOD")), selected = c("AEDECOD") ), hlt = choices_selected( choices = variable_choices(adae, c("AEBODSYS", "AESOC")), selected = "AEBODSYS" ), add_total = TRUE, event_type = "adverse event" ) ) ) if (interactive()) { shinyApp(app$ui, app$server) } image.png (view on web) <https://github.com/insightsengineering/teal/assets/211358/63130662-f32b-435b-9942-c222bf4a1591> — Reply to this email directly, view it on GitHub <#1086 (reply in thread)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/BFYKYFUBNPSWPNTK7DWDOY3YSTBZ3AVCNFSM6AAAAABCXN3YUKVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DIMBXGA4DS> . You are receiving this because you were mentioned.Message ID: ***@***.*** com>
You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
General
Labels
None yet
4 participants
@BhargavAchanta@averissimo@donyunardi@chlebowa

[8]ページ先頭

©2009-2025 Movatter.jp