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 · 8 comments
Open

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
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")

@athowes
Copy link
Collaborator Author

athowes commented Nov 22, 2024

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?

Creating and upkeeping a vignette which lists the models seems to be more work to do than the solution above and also requires more maintanence.

Eventually we want the vignette explaining the models to be up, and perhaps at that point we could switch to pointing to it.

However, that vignette might be quite "mathy" in which case I think allowing users to just get a simple list of the models in the package is still valuable functionality (rather than having to read a load of notation before figuring out which models exist).

@seabbs
Copy link
Contributor

seabbs commented Nov 22, 2024

We need to have the vignetter (or some central source) to list the methods each model uses so I think we can't get away from that. We can minimise the general amount of effort it takes though but just referring back to that.

I also wondered about having another family class that links models together

@athowes
Copy link
Collaborator Author

athowes commented Nov 22, 2024

to list the methods each model uses so I think we can't get away from that

Isn't this the functions reference page?

@seabbs
Copy link
Contributor

seabbs commented Nov 22, 2024

Well maybe but there is too much noise to be useful there I think (due to all the methods per function)

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

No branches or pull requests

2 participants