Dear r-helpers, Could you please tell me what's missing: rbind(paste('txt.est',1:24, sep = '')) txt.est1, ... txt.est24 are vectors that I wish to rbind. _____________________________ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400 Charlottesville, VA 22904-4400 Parcels: Room 102 Gilmer Hall McCormick Road Charlottesville, VA 22903 Office: B011 +1-434-982-4729 Lab: B019 +1-434-982-4751 Fax: +1-434-982-4766 WWW: http://www.people.virginia.edu/~mk9y/
What do you want to do with rbind? paste produces a single vector of 24 character-valued elements. If you want a column vector, you could do that by x <- paste('txt.est',1:24, sep = '') matrix(x, ncol=1) -Christos Christos Hatzis, Ph.D. Nuvera Biosciences, Inc. 400 West Cummings Park Suite 5350 Woburn, MA 01801 Tel: 781-938-3830 www.nuverabio.com> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Michael Kubovy > Sent: Saturday, March 03, 2007 2:30 PM > To: r-help at stat.math.ethz.ch list > Subject: [R] Help with paste() > > Dear r-helpers, > > Could you please tell me what's missing: > rbind(paste('txt.est',1:24, sep = '')) > txt.est1, ... txt.est24 are vectors that I wish to rbind. > _____________________________ > Professor Michael Kubovy > University of Virginia > Department of Psychology > USPS: P.O.Box 400400 Charlottesville, VA 22904-4400 > Parcels: Room 102 Gilmer Hall > McCormick Road Charlottesville, VA 22903 > Office: B011 +1-434-982-4729 > Lab: B019 +1-434-982-4751 > Fax: +1-434-982-4766 > WWW: http://www.people.virginia.edu/~mk9y/ > > ______________________________________________ > R-help at stat.math.ethz.ch 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. > >
On Mar 3, 2007, at 2:29 PM, Michael Kubovy wrote:> Dear r-helpers, > > Could you please tell me what's missing: > rbind(paste('txt.est',1:24, sep = '')) > txt.est1, ... txt.est24 are vectors that I wish to rbind.the paste call just returns a vector of the strings "txt.est1" and so on. Then you tell it to rbind this vector with nothing else. You might want to try something like this, though I hope someone else comes with a better solution: cmd <- paste("rbind(",paste('txt.est',1:24, sep = '',collapse=", "), ")", sep="") eval(parse(text=cmd)) Haris Skiadas Department of Mathematics and Computer Science Hanover College
On Sat, 2007-03-03 at 14:29 -0500, Michael Kubovy wrote:> Dear r-helpers, > > Could you please tell me what's missing: > rbind(paste('txt.est',1:24, sep = '')) > txt.est1, ... txt.est24 are vectors that I wish to rbind.Micheal, Try this, presuming that each vector is the same length: # Create three vectors txt.est1 <- letters txt.est2 <- letters txt.est3 <- letters MAT <- t(sapply(paste('txt.est',1:3, sep = ''), get))> MAT[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] txt.est1 "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" txt.est2 "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" txt.est3 "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] txt.est1 "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" txt.est2 "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" txt.est3 "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" [,23] [,24] [,25] [,26] txt.est1 "w" "x" "y" "z" txt.est2 "w" "x" "y" "z" txt.est3 "w" "x" "y" "z" So in your case: MAT <- t(sapply(paste('txt.est',1:24, sep = ''), get)) See ?get You need to use get() in order to 'get' the actual vectors using the vector names created in paste() HTH, Marc Schwartz