cbind problem (PR#339)

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


On Tue, 23 Nov 1999 thomas@biostat.washington.edu wrote:

> 
> Probably related to the rbind problem:
> 
Yep.

Patch:

*** /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 10:16:47 1999
***************
*** 1087,1093 ****
  
      /* Adjustment of dimnames attributes. */
      if (have_cnames | have_rnames) {
! 	SEXP nam, tnam;
  	PROTECT(dn = allocVector(VECSXP, 2));
  	if (have_cnames)
  	    nam = VECTOR(dn)[1] = allocVector(STRSXP, cols);
--- 1087,1093 ----
  
      /* Adjustment of dimnames attributes. */
      if (have_cnames | have_rnames) {
! 	SEXP nam, tnam,v;
  	PROTECT(dn = allocVector(VECSXP, 2));
  	if (have_cnames)
  	    nam = VECTOR(dn)[1] = allocVector(STRSXP, cols);
***************
*** 1100,1112 ****
  
  		if (isMatrix(u)) {
  
! 		    u = getAttrib(u, R_DimNamesSymbol);
! 		    tnam = GetColNames(u);
  
  		    if (have_rnames &&
  			GetRowNames(dn) == R_NilValue &&
! 			GetRowNames(u) != R_NilValue)
! 			SetRowNames(dn, duplicate(GetRowNames(u)));
  
  		    /* rbind() does this only  if(have_?names) .. : */
  		    if (tnam != R_NilValue) {
--- 1100,1112 ----
  
  		if (isMatrix(u)) {
  
! 		    v = getAttrib(u, R_DimNamesSymbol);
! 		    tnam = GetColNames(v);
  
  		    if (have_rnames &&
  			GetRowNames(dn) == R_NilValue &&
! 			GetRowNames(v) != R_NilValue)
! 			SetRowNames(dn, duplicate(GetRowNames(v)));
  
  		    /* rbind() does this only  if(have_?names) .. : */
  		    if (tnam != R_NilValue) {

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