Description
The clusterSize distribution currently relies on dirmult::rdirichlet() to generate unequal cluster sizes. However, dirmult is currently listed in Suggests, which means users can successfully install and load simstudy, but encounter a runtime error when using a documented distribution if dirmult is not installed.
This recently surfaced while running simulations on an HPC cluster, where simstudy was available but dirmult was not.
Proposed changes
- Move dirmult from Suggests to Imports.
- Remove the explicit
requireNamespace("dirmult") check in .genclustsize(), since the dependency will always be available after installation.
- Update the error message (if the runtime check is retained) to refer to the
clusterSize distribution rather than the Poisson distribution.
Current message:
Package "dirmult" must be installed to use this function with the Poisson distribution.
Suggested message:
Package "dirmult" must be installed to use dist = "clusterSize".
Rationale
clusterSize is a documented data-generating distribution and should work after a standard installation of simstudy. Requiring users to manually install an additional package at runtime is unexpected and can be difficult to diagnose, particularly in managed environments such as HPC systems where users may not have permission to install missing packages.
The additional dependency is small, and moving it to Imports provides a more reliable user experience.
Description
The
clusterSizedistribution currently relies ondirmult::rdirichlet()to generate unequal cluster sizes. However,dirmultis currently listed in Suggests, which means users can successfully install and load simstudy, but encounter a runtime error when using a documented distribution ifdirmultis not installed.This recently surfaced while running simulations on an HPC cluster, where
simstudywas available butdirmultwas not.Proposed changes
requireNamespace("dirmult")check in.genclustsize(), since the dependency will always be available after installation.clusterSizedistribution rather than the Poisson distribution.Current message:
Suggested message:
Rationale
clusterSizeis a documented data-generating distribution and should work after a standard installation of simstudy. Requiring users to manually install an additional package at runtime is unexpected and can be difficult to diagnose, particularly in managed environments such as HPC systems where users may not have permission to install missing packages.The additional dependency is small, and moving it to Imports provides a more reliable user experience.