Questions tagged [reticulate]

Usage questions regarding reticulate R package which provides a comprehensive set of tools for interoperability between Python and R.

Questions on the reticulate R package which provides a comprehensive set of tools for interopability between Python and R. More information on tutorials and API reference can be found on reticulate's website.

486 questions
3
votes
2 answers

Call R object from Python with r. in a Quarto document

I try to call an R object from Python inside a Quarto document: --- title: "pandas" format: html jupyter: python3 --- ```{r} data("penguins", package = "palmerpenguins") ``` ```{python} penguins=r.penguins penguins ``` When I execute the chunks…
abichat
  • 2,317
  • 2
  • 21
  • 39
3
votes
2 answers

How to fix reticulate error in RStudio to use python?

I am receiving an error when trying to use reticulate that says library(reticulate) library(tidyverse) library(janitor) Sys.setenv(RETICULATE_PYTHON = "C:/Users/Menu/Programs/Python 3.10.exe") My Python 3.10 is located in…
Zane Cantrell
  • 247
  • 3
  • 9
3
votes
1 answer

How to display a geometric object from Python code in a Rmarkdown document?

I would like to have a point displayed (like in this tutorial) in my rmarkdown document after knitting. Reproducible example: --- title: "Reprex" output: html_document --- ```{python} # Import necessary geometric objects from shapely module from…
busemorose
  • 317
  • 1
  • 6
3
votes
1 answer

Object memory usage with R-reticulate python

I'm wondering how efficiently reticulate handles memory with python objects. Suppose I have a 5GB pandas dataframe object called data_pandas, in reticulate::python and I'd like to make an analysis with R. When I call the object from R like…
Matthew Son
  • 1,109
  • 8
  • 27
3
votes
1 answer

R reticulate install python libraries from Github

Does anyone have any ideas on how to directly install the python libraries available on Github from reticulate? The py_install function only supports libraries available on conda or PyPI. For example, when building an R package based on a python…
user418560
  • 41
  • 6
3
votes
2 answers

How to build a lapply-style function in R with Python code inside with package reticulate?

I built a simple translation function in R with Python code inside. It works well for one string. But how do should apply it for a list of strings? string <- c("cat") string <- c("cat", "dog") translations.df <-…
3
votes
1 answer

Using Reticulate to Run a Python Script with Arguments

I have a python script that has kindly been developed by one of our architects here. I would like to execute it in R using the Reticulate package. The script acts like an API to one of our systems. I call it on my machine providing it with a number…
John Smith
  • 2,448
  • 7
  • 54
  • 78
3
votes
2 answers

Problems in configuration/installation with reticulate [R]

I'm trying to work with reticulate for integrating Python modules inside R and, despite following the tutorial (miniconda is already installed), nothing seems to work properly. I tried with the default way and specifying conda and virtual…
jgarces
  • 519
  • 5
  • 17
3
votes
0 answers

Handling python modules in R package development

I want to create a R package that features functionalities from different python modules. The reticulate package offers a variety of functions to load and execute python modules from within R. For the deployment of my package I was wondering what…
3
votes
1 answer

Error using python in rmarkdown (Error in py_call_impl(callable, dots$args, dots$keywords) ...)

I have the following rmarkdown code: --- title: "test" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) library(reticulate) use_condaenv(condaenv = "daniellgaenv", conda =…
daniellga
  • 1,142
  • 6
  • 16
3
votes
1 answer

Transforming Python list of tuples to R named vector

I have python reticulate function which returns list of two length tuples of type (id, name). # In the python API returned_list = [ (1, "Jon Doe"), (2, "Jane Doe"), ] library(shiny) library(reticulate) # source and other staff API <-…
vahvero
  • 525
  • 11
  • 24
3
votes
0 answers

Support for large sparse matrices R

Is there any support for large sparse matrices in R? I'm currently dealing with a 1.9M sparse square matrix with about 0.001 density. I wanted to stress test the creating of this matrix in R on my AWS spot instance with 480gb…
Olivier
  • 321
  • 2
  • 11
3
votes
0 answers

Reticulate can't find Anaconda installation

I have Anaconda installed on my Mac, and there doesn't seem to be any issue with it. However, the reticulate package does't find my installation even though it's been added to my $PATH. This is my…
Mario Becerra
  • 514
  • 1
  • 6
  • 16
3
votes
1 answer

r reticulate OOP methods failure

I'm quite familiar with python and only know the basics of R; so for a class that requires "use of R", I'm leaning heavily on the library, "reticulate". I've used this a number of times over the past month or two without issues; however, today I…
j9000
  • 386
  • 1
  • 3
  • 14
3
votes
1 answer

R: Reticulate -- How to call a Python script that requires multiple command line arguments

I have a script called DataRetrieval.py. This script connects to an internal database, retrieves data and writes that data to an Excel file. This script imports the following: a) a utils.py helper module that contains several functions b) a…
equanimity
  • 2,371
  • 3
  • 29
  • 53