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
0
votes
1 answer

How can I switch virtualenv from reticulate in R?

In R package reticulate there is a function use_virtualenv but it does not look like I can call it twice with different virtualenvs, second call is always ignored. Is there a way to deactivate first virtualenv so I can call use_virtualenv("venv2")…
BenoitLondon
  • 845
  • 6
  • 19
0
votes
1 answer

How to change libpython path in R for Keras

I installed Keras and Tensorflow in R. When I perform: reticulate::py_config() I got the following message. As detailed Python version 3.6 is used while I installed 3.8 previously. > reticulate::py_config() python: …
Laurent
  • 419
  • 4
  • 14
0
votes
1 answer

Source_python not working when called from within app.R

I have a shiny app that requires python code. Source_python works fine when I call it from RStudio, but when I run the shiny app (sourcing the python file from within app.R), the python code is not available. I am using a virtual python environment…
Yuki Weber
  • 21
  • 1
  • 4
0
votes
1 answer

Subprocess run works from Python, but not when using R and Reticulate

I have a command saved in a text file that I wish to execute using subprocess.run() from R using the reticulate package. I have a directory with three files: test_command.txt which contains the command touch foo.txt run_command.py: import…
DanielWard
  • 71
  • 3
  • 7
0
votes
1 answer

reticulate R package error in fuzzywuzzy module

i have a problem with reticulate package in R library(reticulate) fuz <- import("fuzzywuzzy") print(fuz$ratio("ello", "hello")) i have tried to use fuzzywuzzy(python module) in R but got an error: Error in py_get_attr_impl(x, name, silent) : …
0
votes
1 answer

Error when calling an R object in a python chunk (R markdown)

enter image description hereI am using the library reticulate to run some python code in RStudio. The syntax to call an R object in a python chunk is : r.object. Unfortunatly I have this error message when calling my r.object in the python code…
liliay
  • 13
  • 4
0
votes
1 answer

How to use Python block in R markdown?

I am trying to use a Python block in my R markdown document. Below is what I have been trying: """{r setup, include=FALSE} require(reticulate) use_python("/Users/hyunjindominiquecho/opt/anaconda3", required = T) """ """{python} # import the…
chico0913
  • 577
  • 4
  • 10
  • 22
0
votes
1 answer

Editing keyboard shortcut to produce code chunk in R studio

I'm using Rmd in RStudio to edit in different languages, including Python, bash and R. I am wondering if there is a way to edit the "insert code chunk" option and/or its keyboard shortcut. I would like to have a shortcut to insert a Python code…
Sos
  • 1,783
  • 2
  • 20
  • 46
0
votes
1 answer

Python env in R: Installing python packages in R

I want to read a python file in R and I am using reticulate package for that. I have certain packages in python file. Do I have to install them in R env again somehow, for the file to run? And how do I do that? I am getting this error: Error in…
Mansi
  • 313
  • 1
  • 5
  • 10
0
votes
1 answer

How to Use Reticulate to import Python function in R shiny App for downloads App

I want to use python function in my function.py file and there is one function called run_xi, which is just to extract data from the database and return a data frame to R. However, this code can be run successfully with data_xi <- data.frame(s =…
YihanBao
  • 501
  • 1
  • 4
  • 15
0
votes
1 answer

Call 2 functions on R Shiny dashboard fluidrow()

I am trying to get multiple graphs or tables to show up on a single tab on my R Shiny Dashboard. The tables and graphs are dataframes created from different functions from a python file that the R file calls on. When put individually the functions…
that_guy_808
  • 45
  • 1
  • 7
0
votes
1 answer

how to access R variables in a different environment in a python chunk

I want to pass a variable that's not in the R global environment into a python chunk (using reticulate). Here is an example: library(reticulate) newEnv <- new.env() newEnv$x <- 9 z <- 3 print(r.newEnv$x) This yields an error. Note that I also…
user1713174
  • 307
  • 2
  • 7
0
votes
0 answers

can you run R commands within a python chunk (using reticulate) in Rstudio?

Hi smart people of the internet: I have a rmarkdown file with R and python chunks in it. I want to write a function or two in my python chunks that can affect my global environment in R. I know you can execute python strings within an R chunk but is…
user1713174
  • 307
  • 2
  • 7
0
votes
1 answer

How do I make a data frame or tibble in r from data passed using a Python API in a list or environment object?

Using reticulate, I'm getting data from a Python API through Interactive Brokers. I'd like to convert the data passed from my Python API to a data frame or a tibble, but I'm completely baffled about how to get it done. I also cannot figure out how…
S Novogoratz
  • 388
  • 2
  • 14
0
votes
2 answers

R - undo an array_arrange()

I am after a way to undo the array_reshape() function in R. Any help is welcomed. library(reticulate) mat <- matrix(rep(1:1000), nrow = 10) mat.1 <- array_reshape(mat, c(nrow(mat), 10,10,1)) # make mat.2 the same dimensions as mat mat.2 <-…
tora0515
  • 2,479
  • 12
  • 33
  • 40