I am trying to call the R function memory.limit, with the argument 'size', using rpy2. I followed the instructions given here: Accessing functions with a dot in their name (eg. "as.vector") using rpy2, but cannot get it to work.
This is what I have tried:
from rpy2.robjects.packages import importr
from rpy2 import robjects
utils = importr('utils')
memory_limit = robjects.r("memory.limit")
utils.memory_limit(size=50000)
and also
from rpy2 import robjects
memory_limit = robjects.r("memory.limit")
memory_limit(size=50000)
In both cases I get the following error:
RRuntimeError: Error in (function (size = NA) : incorrect argument
Can you tell me what I am doing wrong?