<jupyter_start><jupyter_text>How to use Python from R It is possible to leverage the package **reticulate** [1] for interoperability between Python and R. Reticulate embeds a Python session within your R session, enabling seamless, high-performance interoperability. It provides a comprehensive set of tools, including facilities for:* Calling Python from R in a variety of ways including R Markdown, sourcing Python scripts, importing Python modules, and using Python interactively within an R session.* Translation between R and Python objects (for example, between R and Pandas data frames, or between R matrices and NumPy arrays).* Flexible binding to different versions of Python including virtual environments and Conda environments.  Installation and configuration<jupyter_code>install.packages("reticulate", repos='http://cran.rstudio.com')
library("reticulate")
use_python("/opt/anaconda/envs/python2/bin/python")<jupyter_output><empty_output><jupyter_text>Simple example using the Python module 'os'<jupyter_code>os <- import("os")
os$name<jupyter_output><empty_output><jupyter_text>A pratical example using the Python module 'ro4eo'<jupyter_code>ro4eo <- import("ro4eo")
token = '<PASSWORD>'
ro_title = 'SatCen Change Detection over Madrid'
ro_description = 'This is the result of the SatCen Change Detection service of the EVER-EST VRC for Land Monitoring'
ro_vrc = 'SatCen'
master = 'https://catalog.terradue.com/sentinel1/search?format=atom&uid=S1A_IW_GRDH_1SDV_20180312T061753_20180312T061818_020978_024034_457D' 
slave = 'https://catalog.terradue.com/sentinel1/search?format=atom&uid=S1A_IW_GRDH_1SDV_20180216T061753_20180216T061818_020628_02351B_9F18'
aoi_wkt = 'POLYGON((-3.611068725585937 40.57602136929037,-3.611068725585937 40.42669550575275,-3.4047317504882812 40.42669550575275,-3.4047317504882812 40.57602136929037,-3.611068725585937 40.57602136929037))'
roeo = ro4eo$EOResearchObject(access_token=token,
                       title=ro_title,
                       description=ro_description,
                       vrc=ro_vrc,
                       aoi=aoi_wkt)
roeo$isTokenValid()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08508648901355774, 'fraction_numerical': 0.12108461898083217, 'mean_word_length': 5.625386996904025, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 14, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '513879', 'license': 'Apache-2.0', 'n_tokens_mistral': 862, 'n_tokens_neox': 694, 'n_words': 172, 'path': 'How to use Python from R.ipynb', 'repo_name': 'ec-everest/e-learning-r-examples', 'size': '2165'}