1

I have two character objects of different length:

a <- "A"
bc <- c("B","C")

Now I would like to concatenate these in such a manner that I get "ABC", but paste() repeats a as many times as length(bc):

paste("a",c("b","c"),collapse="", sep="")
> "ABAC"

Anyone an idea on how to get "ABC" instead of "ABAC"?

Many thanks!

Rob
  • 1,460
  • 2
  • 16
  • 23

1 Answers1

3

Try this

> paste(c(a,bc), collapse="", sep="")
[1] "ABC"
Jilber Urbina
  • 58,147
  • 10
  • 114
  • 138