Search code examples
rstring-concatenation

How do I add characters to the beginning or end of result of paste0?


I am trying to create a character string that looks something like "c,1,2,3,4,5,6,7,8"

I am able to get the number part of the string by doing:

paste0(1:200, collapse = ",")

How would I add "c," to the beginning of the result of paste0? Alternatively, how could I join ",c" end of the result?


Solution

  • You just want the string c, not the function right?

    paste0(c("c", 1:8), collapse = ",")