Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some way to refer to the models (and data structures) in the package? #448

Open
athowes opened this issue Nov 16, 2024 · 4 comments
Open
Labels
medium Nice to have for next release

Comments

@athowes
Copy link
Collaborator

athowes commented Nov 16, 2024

In PR #447 I suggested adding documentation like:

#' @param data An object with class corresponding to an implemented model.
#' The currently available models classes are `epidist_latent_model` and
#' `epidist_naive_model`.

I think this is fine for now but really we don't want to have to be updating documenation like this when we add a new model.

Instead, I think perhaps we could have some kind of data object or function in the package which lists the available models. Then in documentation we say that you can call epidist_model_classes() to look at them. Or for the data ones we can say that they can call epidist_data_classes().

What do you think @seabbs? I think this is something you've probably encountered before.

@athowes athowes added the medium Nice to have for next release label Nov 16, 2024
@athowes
Copy link
Collaborator Author

athowes commented Nov 18, 2024

Here's a possible design:

> epidist_models <- function() {
+   all_objects <- ls(asNamespace("epidist"))
+   model_functions <- grep("^as_epidist_.*_model$", all_objects, value = TRUE)
+   model_names <- sub("^as_epidist_([a-z_]+)$", "\\1", model_functions)
+   unique(model_names)
+ }
> epidist_models()
[1] "latent_model"   "marginal_model" "naive_model"   

Could do similar for data classes.

@seabbs
Copy link
Contributor

seabbs commented Nov 19, 2024

Yes could do. Maybe in the first instance though we jus want to have aim for a vignette that lists the models in a single place and then point to that?

@athowes
Copy link
Collaborator Author

athowes commented Nov 19, 2024

I don't know about refering to vignettes from the roxygen (whether it's possible)

@seabbs
Copy link
Contributor

seabbs commented Nov 19, 2024

it is I think using vignettes("name of vignette")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium Nice to have for next release
Projects
None yet
Development

No branches or pull requests

2 participants