Thank you for your interest in contributing to this repo! Your contribution is highly valued. Please go through this document for guidance on how to contribute.
Please follow the programming conventions to ensure a consistent programming style across the package.
Generally we follow the tidyverse style guide. Some specific conventions that deviate from this are explained below.
snake_case
).h_
are helper functions and they should not be exported.roxygen2
(even when they are not exported).In package mmrm
, we follow the following convention in package imports.
DESCRIPTION
, add that package into Imports
.mmrm-package.R
, we add a importFrom
with a single function from the package.package::function
style wherever you need to use the function.stats
.DESCRIPTION
, add that package into Imports
.mmrm-package.R
, we use a import
to import every function.checkmate
.roxygen2
chunks, including internal functions (see also above).lifecycle
badge to clarify the maturity."experimental"
status and consider upgrading to "stable"
once the interface has been stable for several months.Title Style
for the title of the documentation.@description
part with at least one sentence describing the object.@param formula (`formula`)\cr the model formula, see details.
So the type of the argument is in parentheses, followed by line break, followed by lower case half-sentence ending with a full stop.[function()]
to reference other functions._pkgdown.yml
file to be populated on the pkgdown
website.pkgdown
web pages. Note that this includes only exported objects. To make it look similar to the help page references, please here also use function()
style.mmrm_review_methods.Rmd
is a large vignette and we cache the comparison results in cached_mmrm_results
. Before every release we need to update the data with the script data-raw/mmrm_review.R
.
Please note you need to install the package and then compile the vignette, because efficiency is better after installation to provide a fair comparison. When using GitHub to collaborate, the following conventions are needed:
mmrm
repository, instead of creating forks, unless you are not yet a team member.<issue_id>_<short_discription>
.The development this mmrm
package is based on the latest R version and C++ compilers.
The package dependencies are the most recent versions from CRAN.
We recommend that your working environment is set up in the same way.
Additionally, there are some tools we recommend you to install:
RTools
if you work on a Windows operating system. Alternatively you can use docker
to separate the operating system and the development system.GitKraken
is a very useful user interface for git including visualization of git commit graphs, file history, etc.lintr
will allow you to perform static code analysis.pre-commit
is a Python module that allows you to identify issues before you commit locally.The issues are categorized with several labels:
| Label name | Description |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------- |
| SPx
| SP
(story points) indicate complexity, and the larger the subsequent number, the more time consuming the issue is expected to be |
| priority
| Issues with this label should be completed with higher priority |
| good first issue
| Good choices for new team members |
| blocked
| Blocked by other issues |
| bug
| Something isn't working |
| devops
| Development and Operation |
| discussion
| Discussion needed |
| documentation
| Improvement of documentation is needed |
| duplicate
| The issue already exists |
| enhancement
| New feature or request |
| help wanted
| Extra attention is needed |
| invalid
| This doesn't seem right |
| question
| Further information needed |
Please choose an issue based on your interest, issue complexity, and priority.
To add a new unit test, you need to first identify the test scope.
Does the test fit in the scope of existing tests?
If so, please modify the existing test files under tests/testthat/
folder or src/
folder, depending on whether the code to be tested is R or C++.
Otherwise please create a new test file, with a name prefix of "test-".
In each test case, use the following structure:
test_that("function_name does something as expected", { result <- function_name(input) expected <- hardcoded_result expect_identical(result, expected) })
The purpose of the test should be clearly stated first.
In the test body part, conduct the tests, e.g. use expect_identical
to check consistency, expect_error
to catch error messages, etc.
The test body should not follow the same implementation logic as the package did, otherwise we may miss mistakes in implementation.
Integration tests compare the results of SAS and R and assures the quality of our code. To add an integration test, you need to do the following:
proc mixed
, using fev_data
..txt
format in the design/SAS/
folder.If you have no experience with C++, it is totally fine: TMB
has provided us with many high-level functionalities that is very similar to R
.
Here we only list the most important things that you need to go through before you begin C++ programming.
int i = 1;
This works, as we declare i
as int
and define it to be 1.i = 1;
This fails, because i
is not declared yet.int i; i = 1;
This works, because i
is declared and then defined.int i = 1, j = 2;
This works, because i
and j
are both int
.if (TRUE) { a = '123' }; print(a)
is legal.if (1) {string a = '123'}; std::stdout << a << std::endl;
is illegal, because object a
is terminated already.string a; if (1) {a = '123'}; std::stdout << a << std::endl;
is legal, a
is declared prior to if statement.Template
is a special function that works with generic argument type. We could imagine a single function that could work on arguments of arbitrary type, and template
functions make this possible through separation of function logic from the argument declaration. In this way we can use template
functions and avoid the need to replicate the whole code for each type.With these points in mind, you are about ready to go.
In mmrm
we are not including any latent variables and so the Laplace approximation aspect of TMB
is not used. We only use the automatic differentiation part of TMB
. For detailed documentation of TMB
, visit the TMB reference.
One important feature of TMB
are the R style matrix/array calculations. This is important because we mainly use this part to conduct our calculations. See matrix_arrays.cpp for examples.
To add a new covariance structure, you need to do the following:
design/SAS/
folder to make sure SAS and R produce similar results (within tolerance).To add additional data to mmrm
, please follow the next steps:
R/data.R
.save
to create an rda
data only containing this dataset. Here
the function usethis::use_data
can also be helpful.There are several communication channels, please use appropriate ones.
GitHub issues and pull requests are where implementations are discussed and reviewed. Feature requests, bugs, enhancements, technical implementations can be discussed here. When you have ideas that needs to be documented, it is better to have them in GitHub.
Slack is a messaging tool and we have the mmrm
channel under the rinpharma
space.
You can put anything in the slack channel, e.g., you have completed a issue and are waiting for review, or you have some questions and don't want to wait until the next stand-up meeting.
To join the slack channel, please make sure you have a slack account, and send the email address to any team member.
We have stand-up meetings currently three times a week. The purpose of stand-up meetings is for team members to discuss the current work progress and raise any issue/questions for team discussion if needed.
You don't need to join all three meetings.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.