Reputation: 41
The R code mentioned below is using a library CALIBERdrugdose and is returning a dataframe by using fuction doseconverter. We need to call this r script or rfunc(x) in python how we can do that?
library(CALIBERdrugdose)
rfunc <- function(x){
l=doseconvert(c(x))
return(l)
}
when i tried to run it this way
robjects.r('''
# create a function `f`
library(CALIBERdrugdose)
rfunc <- function(x){
l=doseconvert(c(x))
return(l)
}
# call the function `f` with argument value 3
rfunc("sadas")
''')
it was giving me this error..
RRuntimeError Traceback (most recent call last)
<ipython-input-89-5aea02cf4722> in <module>()
10 # call the function `f` with argument value 3
11 rfunc("sadas")
---> 12 ''')
D:\workspace\lib\site-packages\rpy2\robjects\__init__.py in __call__(self, string)
350 def __call__(self, string):
351 p = _rparse(text=StrSexpVector((string,)))
--> 352 res = self.eval(p)
353 return conversion.ri2py(res)
354
D:\workspace\lib\site-packages\rpy2\robjects\functions.py in __call__(self, *args, **kwargs)
176 v = kwargs.pop(k)
177 kwargs[r_k] = v
--> 178 return super(SignatureTranslatedFunction, self).__call__(*args, **kwargs)
179
180 pattern_link = re.compile(r'\\link\{(.+?)\}')
D:\workspace\lib\site-packages\rpy2\robjects\functions.py in __call__(self, *args, **kwargs)
104 for k, v in kwargs.items():
105 new_kwargs[k] = conversion.py2ri(v)
--> 106 res = super(Function, self).__call__(*new_args, **new_kwargs)
107 res = conversion.ri2ro(res)
108 return res
RRuntimeError: Error in library(CALIBERdrugdose) :
there is no package called 'CALIBERdrugdose'
Upvotes: 0
Views: 511
Reputation: 11565
The error message returned by R is pointing out the absence of the package you would like to use, or rather the inability of R to find it in order to load it.
Upvotes: 1