insightsengineering / teal.modules.general

General Purpose Teal Modules
https://insightsengineering.github.io/teal.modules.general/
Other
9 stars 13 forks source link

[Bug]: modules crash if package not attached #786

Open chlebowa opened 1 month ago

chlebowa commented 1 month ago

What happened?

Unless the package is attached, at least some modules fail. THIS IS A TWO-PART ISSUE

PART 1

teal.modules.general seems to rely on the magrittr pipe but does not re-export it.

teal_app <- teal::init(
  data = teal.data::teal_data(ADSL = teal.modules.general::rADSL),
  modules = teal::modules(teal.modules.general::tm_missing_data())
)
shiny::runApp(teal_app)

image

I suggest re-exporting the pipe operator OR replacing it with the native pipe.

PART 2

tm_missing_data (and possibly other modules) requires ggplot2 to be attached (ggplot function used without prefix) but does not enforce attaching, unless it is itself attached.

library(magrittr)
teal_app <- teal::init(
  data = teal.data::teal_data(ADSL = teal.modules.general::rADSL),
  modules = teal::modules(teal.modules.general::tm_missing_data())
)
shiny::runApp(teal_app)

image

sessionInfo()

No response

Relevant log output

No response

Code of Conduct

Contribution Guidelines

Security Policy

gogonzo commented 1 month ago

Makes sense. We removed re-export of the magrittrrecently so we should fix the modules now. @donyunardi

chlebowa commented 1 month ago

I think the native pipe is safe to use now 👍

gogonzo commented 1 month ago

I think the native pipe is safe to use now 👍

I think it is, R 4.1 released in May 2021 (pipe where introduced then), it has been more than 3 years. Most of the systems have updated already (I hope so)

chlebowa commented 1 month ago

After the .rds debacle many systems may be using R 4.4 already 😉