VOOZH about

URL: https://www.geeksforgeeks.org/r-language/str_c-function-of-stringr-package-in-r/

⇱ str_c() Function of stringr Package in R - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

str_c() Function of stringr Package in R

Last Updated : 2 Jun, 2022

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")

str_c() Methods

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"
Comment
Article Tags:

Explore