Re: [Rd] By default, `names-` alters S4 objects

2011-05-17 Thread John Chambers
One point that may have been unclear, though it's surprising if so. The discussion was about assigning names to S4 objects from classes that do NOT have a formal names slot. Of course, having a names slot is not illegal, it's what one should do to deal with names in S4. Look at class

Re: [Rd] By default, `names-` alters S4 objects

2011-05-17 Thread Hervé Pagès
On 11-05-17 09:04 AM, John Chambers wrote: One point that may have been unclear, though it's surprising if so. The discussion was about assigning names to S4 objects from classes that do NOT have a formal names slot. Of course, having a names slot is not illegal, it's what one should do to deal

Re: [Rd] By default, `names-` alters S4 objects

2011-05-17 Thread John Chambers
On 5/17/11 9:53 AM, Hervé Pagès wrote: On 11-05-17 09:04 AM, John Chambers wrote: One point that may have been unclear, though it's surprising if so. The discussion was about assigning names to S4 objects from classes that do NOT have a formal names slot. Of course, having a names slot is not

Re: [Rd] By default, `names-` alters S4 objects

2011-05-17 Thread Hervé Pagès
On 11-05-17 01:15 PM, John Chambers wrote: On 5/17/11 9:53 AM, Hervé Pagès wrote: On 11-05-17 09:04 AM, John Chambers wrote: One point that may have been unclear, though it's surprising if so. The discussion was about assigning names to S4 objects from classes that do NOT have a formal names

Re: [Rd] By default, `names-` alters S4 objects

2011-05-16 Thread John Chambers
You set up a names slot in a non-vector. Maybe that should be allowed, maybe not. But in any case I would not expect the names() primitive to find it, because your object has a non-vector type (S4). You could do a@names if you thought that made sense: setClass(A,

Re: [Rd] By default, `names-` alters S4 objects

2011-05-16 Thread Hervé Pagès
On 11-05-16 09:36 AM, John Chambers wrote: You set up a names slot in a non-vector. Maybe that should be allowed, maybe not. But in any case I would not expect the names() primitive to find it, because your object has a non-vector type (S4). But the names-() primitive *does* find it. So either

Re: [Rd] By default, `names-` alters S4 objects

2011-05-16 Thread John Chambers
On 5/16/11 10:09 AM, Hervé Pagès wrote: On 11-05-16 09:36 AM, John Chambers wrote: You set up a names slot in a non-vector. Maybe that should be allowed, maybe not. But in any case I would not expect the names() primitive to find it, because your object has a non-vector type (S4). But the

Re: [Rd] By default, `names-` alters S4 objects

2011-05-16 Thread Hervé Pagès
On 11-05-16 01:53 PM, John Chambers wrote: On 5/16/11 10:09 AM, Hervé Pagès wrote: On 11-05-16 09:36 AM, John Chambers wrote: You set up a names slot in a non-vector. Maybe that should be allowed, maybe not. But in any case I would not expect the names() primitive to find it, because your

Re: [Rd] By default, `names-` alters S4 objects

2011-05-16 Thread Hervé Pagès
On 11-05-16 04:13 PM, Hervé Pagès wrote: On 11-05-16 01:53 PM, John Chambers wrote: On 5/16/11 10:09 AM, Hervé Pagès wrote: On 11-05-16 09:36 AM, John Chambers wrote: You set up a names slot in a non-vector. Maybe that should be allowed, maybe not. But in any case I would not expect the

Re: [Rd] By default, `names-` alters S4 objects

2011-05-15 Thread John Chambers
This is basically a case of a user error that is not being caught: On 5/14/11 3:47 PM, Hervé Pagès wrote: Hi, I was stumped by this. The two S4 objects below looked exactly the same: a1 An object of class A Slot aa: integer(0) a2 An object of class A Slot aa: integer(0) str(a1) Formal

Re: [Rd] By default, `names-` alters S4 objects

2011-05-15 Thread Hervé Pagès
On 11-05-15 11:33 AM, John Chambers wrote: This is basically a case of a user error that is not being caught: Sure! https://stat.ethz.ch/pipermail/r-devel/2009-March/052386.html On 5/14/11 3:47 PM, Hervé Pagès wrote: Hi, I was stumped by this. The two S4 objects below looked exactly

[Rd] By default, `names-` alters S4 objects

2011-05-14 Thread Hervé Pagès
Hi, I was stumped by this. The two S4 objects below looked exactly the same: a1 An object of class A Slot aa: integer(0) a2 An object of class A Slot aa: integer(0) str(a1) Formal class 'A' [package .GlobalEnv] with 1 slots ..@ aa: int(0) str(a2) Formal class