Re: rbind problem (PR#338)

About this list Date view Thread view Subject view Author view Other groups

Subject: Re: rbind problem (PR#338)
From: Thomas Lumley (thomas@biostat.washington.edu)
Date: Wed 24 Nov 1999 - 04:12:24 EST


Message-ID: <Pine.GSO.4.10.9911231008180.18031-100000@wompom.biostat.washington.edu>

Ok, here's a patch:

        -thomas

*** /usr/local/src/R-0.90.0/src/main/bind.c Fri Nov 12 15:33:28 1999
--- /biostat/faculty0/thomas/Rarchive/r-devel/R/src/main/bind.c Tue Nov 23 09:40:25 1999
***************
*** 1299,1305 ****
      }
      /* Adjustment of dimnames attributes. */
      if (have_rnames | have_cnames) {
! SEXP nam, tnam;
          PROTECT(dn = allocVector(VECSXP, 2));
          if (have_rnames)
              nam = VECTOR(dn)[0] = allocVector(STRSXP, rows);
--- 1299,1305 ----
      }
      /* Adjustment of dimnames attributes. */
      if (have_rnames | have_cnames) {
! SEXP nam, tnam,v;
          PROTECT(dn = allocVector(VECSXP, 2));
          if (have_rnames)
              nam = VECTOR(dn)[0] = allocVector(STRSXP, rows);
***************
*** 1312,1323 ****
  
                  if (isMatrix(u)) {
  
! u = getAttrib(u, R_DimNamesSymbol);
! tnam = GetRowNames(u);
  
                      if (have_cnames && GetColNames(dn) == R_NilValue
! && GetColNames(u) != R_NilValue)
! SetColNames(dn, duplicate(GetColNames(u)));
  
                      /* cbind() doesn't test have_?names BEFORE tnam!=Nil..:*/
                      if (have_rnames) {
--- 1312,1323 ----
  
                  if (isMatrix(u)) {
  
! v = getAttrib(u, R_DimNamesSymbol);
! tnam = GetRowNames(v);
  
                      if (have_cnames && GetColNames(dn) == R_NilValue
! && GetColNames(v) != R_NilValue)
! SetColNames(dn, duplicate(GetColNames(v)));
  
                      /* cbind() doesn't test have_?names BEFORE tnam!=Nil..:*/
                      if (have_rnames) {

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b25 : Tue 04 Jan 2000 - 14:16:10 EST