0

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 portion... (screenshot below). Also I am running my code on an rstudio instance on an amazon cloud (should not pose a problem...) Do not really understand why...

Thanks in advance for helping :)

You will also find the R code portion that comes right before i run the python chunk enter image description here

liliay
  • 13
  • 4

1 Answers1

0

It's hard to know what your trying to do, but I can help you read the error.

You can see that the error is coming from line 10 which is this one:

for f in r.test_idx.keys():

You don't have any object before this line that instantiates r. As far as the code is concerned, r does not exist and you are trying to call the test_idx.keys() method from the r object.

There's actually nothing in the for loop that references anything outside of it.

Are these values defined in the R chunks of the code?

If so, can you post the R chunks that precede this and I can help further.

Kind Regards

ejooco
  • 11
  • 2
  • Thank you for your insight. I am adding the piece of code that comes before this portion in which i define the r object test_idx :) – liliay Jun 25 '20 at 14:41