IPS
IPS

Reputation: 51

R execution issue - No function found corresponding to methods exports from 'Runuran' for: 'initialize', 'show'

I am trying to run an Rscript. Each time it throws a warning message:

"no function found corresponding to methods exports from 'Runuran' for: 'initialize', 'show'"

while loading the package Runuran, and execution gets halted with the following error message -

Error in initialize(value, ...) : cannot use object of class "character" in new(): class "unuran" does not extend that class Calls: urweibull -> new -> initialize -> initialize Execution halted

I would really appreciate any help that I could get. I am using R-3.2.1

Upvotes: 5

Views: 1275

Answers (1)

Russ Hyde
Russ Hyde

Reputation: 2269

A bit late but this just happened to me for bioconductor::GEOquery.

This occurs because Runuran exports methods named initialize and show. There are functions with these names within the package methods and Runuran is trying to turn those functions into generic methods (as described in the secion on "creating new methods and generics" in Hadley Wickham's "OO field guide"). It is failing to do this, because methods::initialize and methods::show are not visible in your Rscript run.

In an R session, methods is attached at bootup, but it is not attached automatically when you run Rscript. (Compare the 'attached base packages' when calling sessionInfo() within Rscript and R). At least, this is the case up to R-3.4.2.

A simple fix is to add library(methods) into your script or to call your script using Rscript -e "library(methods); source(<script_name>)"

Upvotes: 2

Related Questions