I have just installed the MSwM package from CRAN into my personal library location via RStudio, and I am trying to call it from Python using rpy2. However, it is giving me this error:
rpy2.rinterface.RRuntimeError: Error in loadNamespace(name) :
there is no package called 'MSwM'
I have tried referencing the standard package and they have no problems loading. Here is my code in Python:
from rpy2.robjects import r
from rpy2.robjects.packages import importr
base=importr('base')
utils=importr('utils')
markov=importr('MSwM')
So, both base and utils are properly loaded, but markov fails to load. Can anyone shed some light on how I can get packages in personal library location to run in rpy2?(btw my set up is in Windows 7) Just a FYI the current environment set up is like this : R_USER=xxx R_HOME=C:\Program Files\R\R-3.2.2
My personal library is in C:\Users\xxx\Documents\R\win-library\3.2 and I am able to get MSwM loaded and run in RStudio itself.
Never mind.I found the answer as importr has the lib_loc parameter to specify the location of the package, so I am doing the following and it is working now: