You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since version 1.00 madrat allows to link packages to it and make use of its functionality. For linking madrat (in version >= 2.5.1) has to be added as a package dependency.
```
Depends: madrat(>= 2.5.1)
```
In addition the following lines of code should be added as `madrat.R` to the R folder of the package.
```{r, eval = FALSE}
.onAttach <- function(libname, pkgname) {
madrat::madratAttach(pkgname)
}
.onDetach <- function(libpath) {
madrat::madratDetach(libpath)
}
```
The `.onAttach` statement makes sure that the package is linked to madrat as soon as it is loaded. The replacements of `cat`, `message`, `warning` and `stop`are required to make use of the specific notification system in madrat, which makes for instance sure that all notes, warnings and error messages will show up in the written log files.
Besides these modifications no further changes are required and functions in the new package will be visible to the `madrat` wrapper functions.
The .onAttach statement makes sure that the package is linked to madrat as soon as it is loaded.
This is not correct. Packages are linked to madrat only when their namespace is attached to the search path, (i.e. declared as a Depends dependency), not when they are loaded (declared as a Imports dependency).
There is no documentation that other madrat-based packages must be declared as Depends dependencies in order to be registered with madrat. See discussion in madrat caching dependent on attached packages #219.
The replacements of cat, message, warning and stop are required to make use of the specific notification system in madrat, which makes for instance sure that all notes, warnings and error messages will show up in the written log files.
Should include example code, then.
The text was updated successfully, but these errors were encountered:
madrat/vignettes/madrat.Rmd
Lines 174 to 196 in d664da2
This is not correct. Packages are linked to
madrat
only when their namespace is attached to the search path, (i.e. declared as aDepends
dependency), not when they are loaded (declared as aImports
dependency).There is no documentation that other madrat-based packages must be declared as
Depends
dependencies in order to be registered withmadrat
. See discussion in madrat caching dependent on attached packages #219.Should include example code, then.
The text was updated successfully, but these errors were encountered: