Prepare a python string for R using rpy2
This question relates to python variable to R and perhaps also to this python objects to rpy2 but none of the two completely overlaps and the first one is actually unanswered. My question is actually very simple. I have a string, say: In [21]: strg Out[21]: 'I want to go home' and I want to pass it to R through robjects.r(''' ''') like this, for example: robjects.r(''' test <- gsub("to", "",strg) ''') but of course, when I run this I obtain: Error in gsub("me", "", strg) : object 'strg' not found . I have not used rpy2 much (as obvious) but I guess is related to the environments in which R and