Accessing a library's function via the double colon operator doesn't seem to work.

Issue #408 invalid
kurt.wheeler91@gmail.com
created an issue

I am attempting to use the SCAN.UPC(http://bioconductor.org/packages/release/bioc/html/SCAN.UPC.html) library via rpy2. If I try to call one of its functions using the double colon operator like so:

ro.r["SCAN.UPC::SCANfast"](
  raw_file,
  processed_file
)

I get the error:

LookupError: 'SCAN.UPC::SCANfast' not found

However if I load the library via the library function first and then call the function I want to use like so:

ro.r("library('SCAN.UPC')")
ro.r["SCANfast"](
  raw_file,
  processed_file
)

it works. Is there any way this could be supported? It's definitely not a major issue but my understanding is that using the double colon operator is a best practice for R code. Perhaps there's a way to actually do it but searching on both google and stackoverflow didn't turn up any results related to rpy2 and double colon.

Comments (2)

  1. Laurent Gautier

    SCAN.UPC::SCANfast is not an R symbol (SCANfast is, within the R namespace SCAN.UPC).

    Try

    ro.r['::']('SCAN.UPC', 'SCANfast')(
      raw_file,
      processed_file
    )
    

    or may be it would be easier to use the rpy2 function importr() (see the doc) ?

  2. Log in to comment