Skip to content

Conversation

@averissimo
Copy link
Contributor

@averissimo averissimo commented Sep 2, 2025

WIP (this is a prototype as backwards compatibility may be improved):

Alternative for #389

Changes description

  • Remove usage of yaml_utils.R functions
  • Support exiting top-level toc option
  • Revert the removal and add deprecation message
  • Update documentation

m7pr and others added 30 commits March 19, 2025 08:10
averissimo and others added 21 commits August 26, 2025 15:56
# Pull Request

- Fixes #364

#### Changes description

- On report download save images to folder
- Uses cached HTML base64 images to save time _(avoids re-rendering)_
Co-authored-by: Pawel Rucki <[email protected]>
Signed-off-by: Marcin <[email protected]>
Previously, this was the path that ended up in the Rmarkdown file


<img width="966" height="913" alt="image (3)"
src="https://github.com/user-attachments/assets/11c6d7b8-553e-4fe3-932a-7e4c5258ad11"
/>

that triggered inability to render the report for Windows

```r
Quitting from report.Rmd:41-43 [unnamed-chunk-4]
Render document error: Error in `gzfile()`:
! cannot open the connection
```

The root cause is `tempfile` in `.content_to_rmd`

```r
sprintf("```{r echo = FALSE, eval = TRUE}\nreadRDS('%s')\n```", tempfile(pattern = "report_item_", fileext = ".rds", tmpdir = "."))
[1] "```{r echo = FALSE, eval = TRUE}\nreadRDS('.\\report_item_1c5031484b54.rds')\n```"
tempfile(pattern = "report_item_", fileext = ".rds", tmpdir = ".")
[1] ".\\report_item_1c503c7536c0.rds"
```

The solution is to take the `basename()` to curate the name of the file
on windows

```r
sprintf("```{r echo = FALSE, eval = TRUE}\nreadRDS('%s')\n```", basename(tempfile(pattern = "report_item_", fileext = ".rds", tmpdir = ".")))
[1] "```{r echo = FALSE, eval = TRUE}\nreadRDS('report_item_1c50c277fb2.rds')\n```"
```

---------

Signed-off-by: Marcin <[email protected]>
Co-authored-by: André Veríssimo <[email protected]>
Base automatically changed from basename@teal_reportable to teal_reportable September 2, 2025 11:12
m7pr and others added 5 commits September 2, 2025 13:12
Fix #357 


Now it looks like this

<img width="695" height="457" alt="image"
src="https://github.com/user-attachments/assets/61917eac-dba7-4316-9cee-bad780a0ee16"
/>

Tested with

```r
devtools::load_all('../teal.code')
devtools::load_all('../teal.logger')
devtools::load_all('../teal.data')
devtools::load_all('../teal.reporter')
devtools::load_all('../teal.widgets')
devtools::load_all('../teal.transform')
devtools::load_all('../teal')
devtools::load_all('.')



# ##########################################
#
#   _             _      _       _
#  | |           | |    | |     | |
#  | |_ ___  __ _| |  __| | __ _| |_ __ _
#  | __/ _ \/ _` | | / _` |/ _` | __/ _` |
#  | ||  __/ (_| | || (_| | (_| | || (_| |
#   \__\___|\__,_|_| \__,_|\__,_|\__\__,_|
#                ______
#               |______|
#
#  teal_data
# #########################################

data <- teal_data(join_keys = default_cdisc_join_keys[c("ADSL", "ADRS")])
data <- within(data, {
  require(nestcolor)
  ADSL <- rADSL
  ADRS <- rADRS
})

# For tm_outliers
fact_vars_adsl <- names(Filter(isTRUE, sapply(data[["ADSL"]], is.factor)))
vars <- choices_selected(variable_choices(data[["ADSL"]], fact_vars_adsl))

# For tm_g_distribution

vars1 <- choices_selected(
  variable_choices(data[["ADSL"]], c("ARM", "COUNTRY", "SEX")),
  selected = NULL
)


init(
  data = data,
  modules = modules(
    # ###################################################
    #
    #                                    _
    #                                   (_)
    #   _ __ ___  __ _ _ __ ___  ___ ___ _  ___  _ __
    #  | '__/ _ \/ _` | '__/ _ \/ __/ __| |/ _ \| '_ \
    #  | | |  __/ (_| | | |  __/\__ \__ \ | (_) | | | |
    #  |_|  \___|\__, |_|  \___||___/___/_|\___/|_| |_|
    #             __/ |
    #            |___/
    #
    #  regression
    # ##################################################
    tm_a_regression(
      label = "Regression",
      response = data_extract_spec(
        dataname = "ADSL",
        select = select_spec(
          label = "Select variable:",
          choices = "BMRKR1",
          selected = "BMRKR1",
          multiple = FALSE,
          fixed = TRUE
        )
      ),
      regressor = data_extract_spec(
        dataname = "ADSL",
        select = select_spec(
          label = "Select variables:",
          choices = variable_choices(data[["ADSL"]], c("AGE", "SEX", "RACE")),
          selected = "AGE",
          multiple = TRUE,
          fixed = FALSE
        )
      )
    )
  )
) |> shiny::runApp()

```

---------

Signed-off-by: Marcin <[email protected]>
Co-authored-by: André Veríssimo <[email protected]>
Base automatically changed from teal_reportable to main September 4, 2025 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants