-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #416 from iiasa/issue/415
Improve testing for v3.3; misc cleanup
- Loading branch information
Showing
39 changed files
with
2,001 additions
and
1,968 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,7 @@ rixmp/source/inst/docum/*.html | |
*.pid | ||
coverage.xml | ||
htmlcov | ||
prof/ | ||
|
||
# JetBrains IDEs | ||
*.iml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,30 @@ | ||
.. _rixmp: | ||
|
||
R (``rixmp`` package) | ||
********************* | ||
Usage in R via ``reticulate`` | ||
***************************** | ||
|
||
An R interface to the `ixmp` is provided by the ``rixmp`` package. | ||
``rixmp`` uses the `reticulate <https://rstudio.github.io/reticulate/>`_ R-to-Python adapter to provide access to all features of the :mod:`ixmp` *Python* package | ||
:mod:`ixmp` is fully usable in R via `reticulate`_, a package that allows nearly seamless access to the Python API. | ||
No additional R packages are needed. | ||
|
||
.. code-block:: R | ||
# Load the rixmp package | ||
library(rixmp) | ||
ixmp <- import('ixmp') | ||
# An 'ixmp' object is added to the global namespace. | ||
# It can be used in the same way as the Python ixmp package. | ||
mp <- ixmp$Platform(dbtype = 'HSQLDB') | ||
scen <- ixmp$Scenario(mp, 'model name', 'scenario name', version = 'new') | ||
.. note:: The former ``rixmp`` package was removed in :mod:`ixmp` :ref:`v3.3.0`. | ||
|
||
# etc. | ||
See :ref:`message_ix:install-r` for installing R and `reticulate`_ to use with :mod:`ixmp`. | ||
Those instructions are suitable whether :mod:`message_ix` is also installed, or only :mod:`ixmp`. | ||
|
||
One additional method, :meth:`adapt_to_ret` is provided. | ||
Access its documentation with | ||
Once installed, use reticulate to import the Python package: | ||
|
||
.. code-block:: R | ||
?rixmp::adapt_to_ret | ||
library(reticulate) | ||
ixmp <- import("ixmp") | ||
This function is useful when adding :class:`data.frames` objects to a Scenario: | ||
This creates a global variable, ``ixmp``, that can be used much like the Python module: | ||
|
||
.. code-block:: R | ||
scen$init_set("i") | ||
i.set = c("seattle", "san-diego") | ||
scen$add_set("i", i.set) | ||
# load dataframes | ||
scen$init_par("a", c("i")) | ||
a.df = data.frame(i = i.set, value = c(350, 600) , unit = 'cases') | ||
scen$add_par("a", adapt_to_ret(a.df)) | ||
mp <- ixmp$Platform(name = 'default') | ||
scen <- ixmp$Scenario(mp, 'model name', 'scenario name', version = 'new') | ||
Finally, see the R versions of the :doc:`tutorials`. | ||
|
||
.. _reticulate: https://rstudio.github.io/reticulate/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.