-1

This is my vector

c("A~B", "C~D", "E~F", "G~H","I~J","K~L")

My original vector is much bigger than this. All I nees is to have an output like this:

c("A~B+time", "C~D+time", "E~F+time", "G~H+time","I~J+time","K~L+time")

Without doing manually.

Dplyr package could help me here?

Any help?

Laura
  • 675
  • 10
  • 32

1 Answers1

1

You can use paste0

v <- c("A~B", "C~D", "E~F", "G~H","I~J","K~L")
paste0(v, "+time")
#[1] "A~B+time" "C~D+time" "E~F+time" "G~H+time" "I~J+time" "K~L+time"

or sprintf

sprintf("%s+time", v)
#[1] "A~B+time" "C~D+time" "E~F+time" "G~H+time" "I~J+time" "K~L+time"
Maurits Evers
  • 49,617
  • 4
  • 47
  • 68