[R] Not finding superclass in library

Ramiro Barrantes ramiro at precisionbioassay.com
Mon Feb 23 21:53:17 CET 2015


Thank you for pointing this out.  I had no idea about the distinction but there are some good references on the matter (http://www.r-bloggers.com/packages-v-libraries-in-r/).  I am pasting the corrected version below, any suggestions appreciated:

I have a package that I created that defines a parent class, assayObject.

I created other classes that inherit from it, say assayObjectDemo.  Each one of those classes I wanted to make in its own directory separate from where the assayObject is defined (there are reasons for that).

But now if I do:

library(assayObject)  #<--- where parent object is defined
source("assayObjectDemo.R")

where assayObjectDemo.R is just:

setClass("assayObjectDemo",contains="assayObject")
createDemoAssayObject <- function() {
  df <- data.frame()
  assay<-new(Class="assayObjectDemo")
  assay
}

I get:

Error in reconcilePropertiesAndPrototype(name, slots, prototype, superClasses,  :
  no definition was found for superclass “assayObject” in the specification of class “assayObjectDemo”

What can I do?  There are several reasons why I DO NOT want to define assayObjectDemo in the same package as assayObject, but I am not sure what the issue is here.  If I step through the code in an ESS R session it works fine.

Thanks in advance,

Ramiro

________________________________________
From: Rolf Turner [r.turner at auckland.ac.nz]
Sent: Monday, February 23, 2015 3:41 PM
To: Ramiro Barrantes; r-help at r-project.org
Subject: Re: [R] Not finding superclass in library

On 24/02/15 09:35, Ramiro Barrantes wrote:
> Hello,
>
> I have a library that I created  .....

<SNIP>

No you ***DO NOT***.  You have a ***PACKAGE***.  If you cannot even get
your terminology straight, what hope is there for you?

cheers,

Rolf Turner

--
Rolf Turner
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
Home phone: +64-9-480-4619



More information about the R-help mailing list