Skip to content

DOC: correct rpy2 examples (GH15142) #15450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions doc/source/r_interface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ In the remainder of this page, a few examples of explicit conversion is given. T
Transferring R data sets into Python
------------------------------------

The ``pandas2ri.ri2py`` function retrieves an R data set and converts it to the
appropriate pandas object (most likely a DataFrame):
Once the pandas conversion is activated (``pandas2ri.activate()``), many conversions
of R to pandas objects will be done automatically. For example, to obtain the 'iris' dataset as a pandas DataFrame:

.. ipython:: python

r.data('iris')
df_iris = pandas2ri.ri2py(r['iris'])
df_iris.head()
r['iris'].head()

If the pandas conversion was not activated, the above could also be accomplished
by explicitly converting it with the ``pandas2ri.ri2py`` function
(``pandas2ri.ri2py(r['iris'])``).

Converting DataFrames into R objects
------------------------------------
Expand All @@ -65,7 +67,6 @@ DataFrames into the equivalent R object (that is, **data.frame**):
print(type(r_dataframe))
print(r_dataframe)


The DataFrame's index is stored as the ``rownames`` attribute of the
data.frame instance.

Expand Down