setupStep {XRPython} | R Documentation |
The Setup Step
Description
The file "setup.R"
in the tools
directory is designed to create an explicit definiion of proxy
classes for the "list"
and "dict"
types in Python. The file would be run through
XR::packageSetup()
when creating or modifying these classes in the XRPython
package. It provides
a useful example for the general task of creating an explicit, written-out version of a proxy class.
Details
The setup step generates a file "R/pythonProxyClasses.R"
in the source directory for the package. The
setup step needs to be run twice, first to generate the R code in that file, and again to use the
roxygen2
package to generate documentation.
For the first round, the package needs to be installed with an empty version of the file (the file has to exist
because the package uses a Collate:
directive that mentions it. Running packageSetup()
this time
defines the proxy classes and dumps them (with some extra stuff) to the target file. and adds a line to the
NAMESPACE
to export both classes. (If we were willing to let roxygenize()
create the namespace
directives this would be automatic, but I'm not willing.)
Now the package needs to be installed again, this time with the proxy classes, The second pass of the setup file
runs roxygenize()
. Finally, as usual with roxygenize()
,
the package has to be installed one more time to generate the actual documentation.