Skip to content
Related Articles

Related Articles

Improve Article
Concatenation of Elements without Separator in R Programming – paste0() Function
  • Last Updated : 01 Jun, 2020

paste0() function in R Language is used to concatenate all elements without separator.

Syntax: paste0(…, collapse = NULL)

Parameters:
…: one or more R objects, to be converted to character vectors.
collapse: an optional character string to separate the results.

Example 1:




# R program to illustrate
# paste0 function
  
# Calling paste0() function
paste0("GFG", "gfg")
paste0("GFG", " gfg")
paste0(letters[1:4])

Output :

[1] "GFGgfg"
[1] "GFG gfg"
[1] "a" "b" "c" "d"

Example 2:




# R program to illustrate
# paste0 function
  
# Calling paste0() function
paste0(letters[1:6], collapse ="-")
paste0("G", 1:5)

Output:

[1] "a-b-c-d-e-f"
[1] "G1" "G2" "G3" "G4" "G5"
My Personal Notes arrow_drop_up
Recommended Articles
Page :