Is there a way to rename the columns to something like A and B in the cbind function? x <- rnorm(n = 10, mean = 0, sd = 1) y <- rnorm(n = 10, mean = 0, sd = 1) cbind(x,y)
cbind(A=x, B=y) On Sat, Aug 21, 2010 at 6:53 PM, r.ookie <r.ookie@live.com> wrote:> Is there a way to rename the columns to something like A and B in the cbind > function? > > x <- rnorm(n = 10, mean = 0, sd = 1) > y <- rnorm(n = 10, mean = 0, sd = 1) > cbind(x,y) > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
On 2010-08-21 16:53, r.ookie wrote:> Is there a way to rename the columns to something like A and B in the cbind function? > > x<- rnorm(n = 10, mean = 0, sd = 1) > y<- rnorm(n = 10, mean = 0, sd = 1) > cbind(x,y)Unless I completely misunderstand your query, ?cbind tells you: "... vectors or matrices. These can be given as named arguments." Surely, you checked? -Peter Ehlers
Thanks. On Aug 21, 2010, at 4:01 PM, RICHARD M. HEIBERGER wrote: cbind(A=x, B=y) On Sat, Aug 21, 2010 at 6:53 PM, r.ookie <r.ookie at live.com> wrote: Is there a way to rename the columns to something like A and B in the cbind function? x <- rnorm(n = 10, mean = 0, sd = 1) y <- rnorm(n = 10, mean = 0, sd = 1) cbind(x,y) ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.