![]() |
VOOZH | about |
In this article, we will discuss str_c() function which is available in stringr package. Before going to this method, we have to install and import stringr package.
Syntax:
Install- install.packages("stringr")
Import - library("stringr")This function is used to combine the multiple strings by a separator.
Syntax:
str_c("string1","string2",...............,sep)
where,
strings are the input strings separated by comma and sep is the second parameter used to separate deach string with a delimiter.
Example 1:
In this example, we are concatenating 5 strings without separator.
Output:
[1] "Welcometogeeksforgeeks"
Example 2:
In this example, we are concatenating 5 strings by different separators.
[1] "Welcome,to,geeks,for,geeks" [1] "Welcome to geeks for geeks" [1] "Welcome&to&geeks&for&geeks"