I am using Google colab, I am trying to use an r package via rpy2 but it gives me an error, how can I add this pakage to rpy2 in Google colab. this is my code.
import numpy as np
import rpy2.robjects.numpy2ri
rpy2.robjects.numpy2ri.activate()
from rpy2.robjects.packages import importr
import rpy2.robjects as robj
R = rpy2.robjects.r
DTW = importr('dtw')
The error:
R[write to console]: Error in loadNamespace(name) : there is no package called ‘dtw’
Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
---------------------------------------------------------------------------
RRuntimeError Traceback (most recent call last)
<ipython-input-272-15b6cecae626> in <module>()
6
7 R = rpy2.robjects.r
----> 8 DTW = importr('dtw')
2 frames
/usr/local/lib/python3.6/dist-packages/rpy2/rinterface.py in __call__(self, *args, **kwargs)
787 error_occured))
788 if error_occured[0]:
--> 789 raise embedded.RRuntimeError(_rinterface._geterrmessage())
790 return res
791
RRuntimeError: Error in loadNamespace(name) : there is no package called ‘dtw’
Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
From dtw's github page: