[Rd] cbind(deparse.level=2,...) problems

William Dunlap wdunlap at tibco.com
Tue Feb 9 22:04:12 CET 2010


> -----Original Message-----
> From: Peter Dalgaard [mailto:p.dalgaard at biostat.ku.dk] 
> Sent: Tuesday, February 09, 2010 10:56 AM
> To: William Dunlap
> Cc: r-devel at r-project.org
> Subject: Re: [Rd] cbind(deparse.level=2,...) problems
> 
> William Dunlap wrote:
> > Should the deparse.level=2 argument to cbind
> > and rbind be abandoned?  It is minimally documented,
> > not used in any CRAN package, and causes some problems.
> 
> Bill,
> 
> This code has been touched by Brian quite recently. Try again with a 
> current r-devel checkout. (Specifically, later than r51007).
> 
> -p

Yes, those problems have been fixed in the most
recent r-devel.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

> 
> > E.g.,
> > 
> > (a) If a matrix input has row names but not column names
> >     cbind(deparse.level=2,...) stops.
> > 
> m<-matrix(11:14,nrow=2,ncol=2,dimnames=list(Row=c("R1","R2"),C
ol=charact
> > er()))
> >> cbind(m, 101:102, deparse.level=2)
> > Error in cbind(m, 101:102, deparse.level = 2) :
> >   SET_STRING_ELT() can only be applied to a 'character 
> vector', not a
> > 'NULL'
> > 
> > (b) If no argument is tagged then deparse.level=2
> >     makes no column names, while deparse.level=1 makes
> >     names for for the simple cases (where the argument
> >     is a name):
> >> x<-1:3
> >> cbind(x, 11:13, deparse.level=1)
> >      x
> > [1,] 1 11
> > [2,] 2 12
> > [3,] 3 13
> >> cbind(x, 11:13, deparse.level=2)
> >      [,1] [,2]
> > [1,]    1   11
> > [2,]    2   12
> > [3,]    3   13
> > 
> >      (If one argument is tagged, teens=11:13, then
> >      deparse.level=2 will name columns that
> >      deparse.level=1 will not, like x+1, which I
> >      think is the intended behavior.)
> 
> -- 
>     O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>    c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>   (*) \(*) -- University of Copenhagen   Denmark      Ph:  
> (+45) 35327918
> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: 
> (+45) 35327907
> 



More information about the R-devel mailing list