Repeat and concatenate a string N times

You can use replicate or rep:

replicate(2, "my_string")
# [1] "my_string" "my_string"

rep("my_string", 2)
# [1] "my_string" "my_string"

paste will put it together:

paste(replicate(2, "my_string"), collapse = "")
# [1] "my_stringmy_string"

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)