[R] string concatenate across rows of a matrix??
Albert Kim
alkim at u.washington.edu
Tue Sep 24 21:45:41 CEST 2002
Is there a simple way to string-concatenate across the rows of a matrix or
data.frame into a vector of strings? perhaps using paste() or
something like it?
That is, I want to map from something like x2 below:
> x2 <- data.frame(C1 = letters[1:4], C3=1:4, C3=letters[11:14])
> x2
C1 C3 C3
1 a 1 k
2 b 2 l
3 c 3 m
4 d 4 n
to something like:
[1] "a 1 k"
[2] "b 2 l"
[3] "c 3 m"
[4] "d 4 n"
Sincerely,
Al Kim
Research Scientist
Department of Psychology
University of Washington, Box 351525
Seattle, WA. 98195, USA
E-Mail: alkim at u.washington.edu; Tel: (206)543-2395
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list