[R] paste dataframe

Thomas Lumley tlumley at u.washington.edu
Wed Apr 10 18:19:02 CEST 2002


On Thu, 11 Apr 2002, Olivier Martin wrote:

> Hi all,
> Assume i have two dataframes A and B with characters objects
> for example,
> A<-rbind(c("the","is"),c("and","!"))
> B<-rbind(c("car","red"),c("blue","!"))
>
> and i would like to obtain the C dataframe
> C<-rbind(c("the car", "is red"),c("and blue","!!"))
>
> What is the solution without loops ?

One solution is
  matrix(paste(A,B),2)


	-thomas

Thomas Lumley			Asst. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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