I have the following code in R:
entrezIDs <- select(hgu133a.db, probeNames, "ENTREZID")
from rpy2.robjects.packages import importr
hgu133a_db = importr('hgu133a.db')
entrez_ids = hgu133a_db.select(hgu133a_db, probe_names, 'ENTREZID')
AttributeError: module 'hgu133a.db' has no attribute 'select'
[should have been a comment to @merv 's answer, but exceeded the number characters]
importr() is trying to help a being specific about which package namespace an R object is coming from, while R's common usage is much less so (and can lead to annoyances such as the loading order of R packages having an influence on which one of the functions with the same name is executed).
The tradeoff with
importr is that one has to know where an R symbol is coming from. There is a less-known function in
rpy2 that can help finding where a given R symbol is defined(*): https://rpy2.readthedocs.io/en/version_2.8.x/robjects_rpackages.html#finding-where-an-r-symbol-is-coming-from .
Otherwise, one can also use
r() to retrieve the object that would be picked(*) in an R session.
from rpy2.robjects import r r('select')
(*: as mentioned earlier, the order in which R packages were loaded earlier in the session can have an influence on which R object is picked).