It is best to allow the "manual edit" RStudio 'Addin' to write this function in your script for you. After a tracked manual edit is performed, a patch file is created and saved in the "patches" subdirectory of nm_dir("models"). This function applies the patch to the object.

apply_manual_edit(m, patch_id, return_merge_conf_ctl = FALSE)



An nm object.


Character name of patch. Corresponds to the file name in the "patches" subdirectory of nm_dir("models").


Logical (default = FALSE). If there a merge conflict produced, should the ctl file be returned?


An nm object with modified ctl_contents field.


Generally best to to apply patches before automatic edits and changes in directories e.g. via run_in(). If patches are applied to NONMEM control file sections that are likely to change in the future, the patch may fail to apply. In this case, it is best to view the patch (via the "view patch" RStudio 'Addin') and manually re-implement the changes again in a new manual edit.