Skip to content

Move dirmult from Suggests to Imports and clean up clusterSize dependency handling #257

Description

@kgoldfeld

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.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions