The DSAIDE and DSAIRM packages are very similar in structure, so the text below applies to both. I mostly write DSAIDE, sometimes DSAIRM. Just substitute with whichever package you work on.
/auxiliary
contains folders with related resources that are not used/needed for the package use/build but are useful (to the package authors) for maintenance/development/advertising/tracking of the package/data
contains data used as part of the R package. The data files are documented in data.R in the /R folder./doc
contains the vignettes, this folder is auto-generated and should not be edited, see below./docs
contains the package website created by the pkgdown package. Rebuild with pkgdown::build_site(). Don’t edit manually./inst
contains several important subfolders, further described below./man
contains the documentation for all public functions, automatically generated by roxygen. Do not edit./Meta
contains vignette information and is auto-created by devtools when package is built. Ignore./pkgdown
contains extra files for styling of pkgdown created website. Edit to change layout of package website./R
contains the main R functions, i.e. the simulators and various helper functions. See more details below./tests
contains code/unit tests, done with the testthat package. Add tests as new functionality is added./vignettes
contains the vignette - this is copied to /inst/doc during package building. edits should be done to the file in the /vignettes folder, not the /inst/doc folder.Shiny
app, none directly handle reactive objects, all inputs and outputs are non-reactive objects/variables.This file, located inside /inst/appinformation, contains important meta-data for each app. Any new app needs to be added to this file. The columns are as follows:
appid
- name by which app is known internally. Needs to match entry in main app.R file.apptitle
- Title for app to be shown in main menu.docname
- name of html file that contains app documentation.modelfigname
- name of file containing model figure.simfunction
- name of underlying R code and function that is used by a given app.simfunction2
- a few apps use more than one underlying function, provide the second one here.underlying_function
- a few apps call another underyling simulator function from their main function. Note this here.mbmodel_possible
- an indicator if a given model could be generated through the modelbuilder package. Only possible for simulation models, i.e. not models that themselves call simualtion models, such as fitting, etc.use_mbmodel
- indicator to state if the underlying mbmodel Rds file (in the mbmodels folder) should be used to generate the inputs for the UI or not (see generate_shinyinput
file).use_doc
- indicator if the top portion of the function (the roxygen documentation part) should be used to generate inputs for the UI. One should use either mbmodel or doc.mbmodelname
- name of mbmodel, needed if we use mbmodel for UI generation.nplots
- number of plots that should be returned for a given app. Almost always 1.modeltype
- type of underlying model(s). This is used inside the run_model
function and different actions are taken based on the model type.otherinputs
- shiny command that is needed to generate additional UI elements that are not automatically generated through parsing.If you plan to build/contribute new apps or new features to the package, I would be delighted to include them! The best idea is to first contact me (through Github or email) and tell me that you would like to contribute. We can then discuss a bit before you embark on the effort.
To build a new app, you need to create the following:
If you contribute/send those files, I will - after testing - include them into the package. You’ll of course receive full credit as package contributor.
All libraries/packages needed to allow the package to run should be loaded via the DESCRIPTION file and not in separate R files. See that file for dependencies.
Additional packages are needed for development (but not use) of the package. Those are listed in the suggests section of the DESCRIPTION file.
According to pkgdown, logo should be includes as described here: https://pkgdown.r-lib.org/reference/build_home.html#package-logo
Some simulation functions are coded ‘by hand’, some are generated through modelbuilder. To see which is which, look at the use_mbmodel
column in /inst/appinformation/apptable.tsv
to deploy, follow these steps (also listed in the main app.R file): 1. go into the folder where this file (app.R) resides 2. install the package through CRAN or github if we want to use the github version devtools::install_github(‘ahgroup/DSAIDE’) 3. uncomment this line of code library(‘DSAIDE’) 4. with the above ‘library’ statement active, deploy with: run rsconnect::deployApp(account = ‘epibiouga’) as suitable, change the account to another one, e.g. handelgroup tokens need to be set up for the connection to work 5. comment out the library command again