From maechler at stat.math.ethz.ch  Mon Oct  3 10:28:51 2005
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Mon, 3 Oct 2005 10:28:51 +0200
Subject: [Rd] Question about colnames behavior
In-Reply-To: <433F8EB8.70703@univie.ac.at>
References: <433F8EB8.70703@univie.ac.at>
Message-ID: <17216.60355.877530.104575@stat.math.ethz.ch>

>>>>> "Erich" == Erich Neuwirth <erich.neuwirth at univie.ac.at>
>>>>>     on Sun, 02 Oct 2005 09:39:36 +0200 writes:

    Erich> The following code
    Erich> zzz<-1:10
    Erich> dim(zzz)<-10
    Erich> rownames(zzz)
    Erich> colnames(zzz)

    Erich> yields NULL for the rownames and colnames calls.
    Erich> Let us set rownames

    Erich> rownames(zzz)<-1:10

    Erich> Now rownames(zzz) returns the expected result, but colnames(zzz)
    Erich> produces an error:
    Erich> Error in dn[[2]] : subscript out of bounds

    Erich> So given a onedimensional structure the return behavior of colnames
    Erich> is different depending on the fact if rownames are set or not.

    Erich> Should the behavior of colnames be changed to make the result
    Erich> independent from this fact?

yes, thank you, Erich. 
It should give an error also in the 1st  case which is
BTW identical to  
    zzz <- array(1:10)

Not for R 2.2.0 though, but rather 2.2.1.

Martin



[Rd] Question about colnames behavior
Martin Maechler