"linda.s" <[EMAIL PROTECTED]> writes:

> On 3/23/06, Jim Porzak <[EMAIL PROTECTED]> wrote:
> > C <- cbind(A[, 1], B[, 2])
> >
> >
> The result is:
>      [,1] [,2]
> [1,]    1    2
> [2,]    3    8
> How to keep x and n as the column title?
> Linda

Provided that A and B are data frames:

 cbind(A[1], B[2])

For matrices, you need to use A[,1,drop=FALSE] etc. to get around the
issue of single-column extraction. Or

 cbind(A,B)[,c("x","n")]



-- 
   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
~~~~~~~~~~ - ([EMAIL PROTECTED])                  FAX: (+45) 35327907

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to