Paste function in R is used to concatenate Vectors by converting them into character. paste0 function in R simply concatenates the vector with space separator. lets see an example of paste() Function in R and Paste0() Function in R

**Syntax for Paste Function in R**

##### Arguments

… | one or more R objects, to be concatenated together. |

sep | a character string to separate the terms. |

collapse | an optional character string to separate the results. |

**Simple Paste Function in R:**

In its simplest usage, paste function in R will accept an unlimited number of scalars, and join them together, separating each scalar with a space by default

# paste function in R paste('one',2,'three',4,'five')

** output:**

When multiple arguments are passed to paste, it will vectorize the operation, recycling shorter elements when necessary. This makes it easy to generate variable names with a common prefix

# paste function in R with sep argument paste('X',1:5,sep='')

**output**:

**Paste() function in R with collapse Argument:**

When a vector is passed, collapse argument should be used as a separator

# paste function in R with collapse argument paste(c('one','two','three','four'),collapse=' and ')

**output**:

**Paste() function in R with Sep & collapse Argument:**

The sep= argument controls what is placed between each set of values that are combined, and the collapse= argument can be used to specify a value to use, when joining those individual values to create a single string.

# paste function in R with separator and collapse Argument paste(c('X','Y'),1:5,sep='_',collapse=' and ')

**output**:

**Paste0() Function in R**

Paste0()** **is a simple paste() function with default separator “ ”. paste0() Function will take only two arguments as shown below

**Arguments**

… | one or more R objects, to be concatenated together. |

collapse | an optional character string to separate the results. |

# paste0() function in R paste0('X',1:5)

**output**:

**Paste0() function in R with collapse Argument:**

# paste0() function in R with collapse agrument paste0('X',1:5,collapse=",")