Exercise 1

Create your first teal application!

Reference:

Example

Using iris and mtcars datasets.

# load teal and all dependent packages
library(teal)

# create empty `teal_data` object
data <- teal_data()

# execute code within it
data <- within(data, {
  IRIS <- iris
  MTCARS <- mtcars
})

app <- init(
  data = data,
  modules = list(
    example_module()
  )
)

if (Sys.getenv("QUARTO_ROOT") == "") {
  shinyApp(app$ui, app$server)
}

App

Exercise

Open editor in Shinylive

Change the code above to use ADAM datasets. Please use following dataset(s):

  • teal.data::rADSL - a dummy ADSL dataset
  • teal.data::rADAE - a dummy ADAE dataset
  • teal.data::rADTTE - a dummy ADTTE dataset

Please note these are case-sensitive and all are objects (i.e. no functions - no () needed).

data <- within(data, {
  ADSL <- teal.data::rADSL
  ADAE <- teal.data::rADAE
  ADTTE <- teal.data::rADTTE
})

Exercise (bonus)

Please read on teal::modify_title(), teal::modify_header(), teal::modify_footer() here to further customise your application.

app <- init(
  data = data,
  modules = list(
    example_module()
  )
) |>
  modify_title("My new title") |>
  modify_header("My new header") |>
  modify_footer("My new footer")