Bug 14323 - methods::new(): information not inserted from dots when contains="matrix"
Summary: methods::new(): information not inserted from dots when contains="matrix"
Status: ASSIGNED
Alias: None
Product: R
Classification: Unclassified
Component: S4methods (show other bugs)
Version: R 2.11.1
Hardware: ix86 (32-bit) Windows 32-bit
: P5 enhancement
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2010-06-25 15:18 UTC by Dan Murphy
Modified: 2011-03-20 19:54 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Murphy 2010-06-25 15:18:59 UTC
The help page for "new" says:

The function new begins by copying the prototype object from the class definition. Then information is inserted according to the ... arguments, if any. 

This does not seem to hold when class extends "matrix":

> setClass("A.matrix", contains="matrix", representation(label="character"))
[1] "A.matrix"
> A<-new("A.matrix", matrix("A",1,1), label="A")
> new("A.matrix", A, label="B")
An object of class "A.matrix"
     [,1]
[1,] "A" 
Slot "label":
[1] "A"

It does work when class extends "character":
> setClass("A.character", contains="character", representation(label="character"))
[1] "A.character"
> A<-new("A.character", "A", label="A")
> new("A.character", A, label="B")
An object of class "A.character"
[1] "A"
Slot "label":
[1] "B"

Sincerely,
Dan Murphy