w3resource

R Programming: Concatenate a vector

R Programming: Vector Exercise-21 with Solution

Write a R program to concatenate a vector.

Sample Solution :

R Programming Code :

a = c("Python","NumPy", "Pandas")
print(a)
x = paste(a, collapse = "")
print("Concatenation of the said string:")
print(x)

Sample Output:

[1] "Python" "NumPy"  "Pandas"
[1] "Concatenation of the said string:"
[1] "PythonNumPyPandas"                         

R Programming Code Editor:



Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a R program to reverse the order of given vector.
Next: Write a R program to count number of values in a range in a given vector.

Test your Programming skills with w3resource's quiz.

What is the difficulty level of this exercise?



Follow us on Facebook and Twitter for latest update.