rbind problem (PR#338)

Thomas Lumley thomas@biostat.washington.edu
Tue, 23 Nov 1999 10:12:24 -0800 (PST)


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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._