Created
March 25, 2023 16:24
-
-
Save lgautier/79489dcf8b56dd71149b28e9b375ca0e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Python 3.8.10 (default, Mar 13 2023, 10:26:41) | |
Type 'copyright', 'credits' or 'license' for more information | |
IPython 8.11.0 -- An enhanced Interactive Python. Type '?' for help. | |
In [1]: from rpy2.robjects.packages import importr | |
In [2]: reticulate = importr('reticulate') | |
WARNING: The R package "reticulate" only fixed recently | |
an issue that caused a segfault when used with rpy2: | |
https://github.com/rstudio/reticulate/pull/1188 | |
Make sure that you use a version of that package that includes | |
the fix. | |
In [3]: pytime = getattr(reticulate, 'import')('time') | |
In [4]: import rpy2.robjects as ro | |
In [5]: ro.r('`$`')(pytime, 'ctime')() | |
Out[5]: | |
<rpy2.robjects.vectors.StrVector object at 0x7f5401897140> [RTYPES.STRSXP] | |
R classes: ('character',) | |
['Sat Mar 25 12:21:32 2023'] | |
In [6]: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment