Open In App
Related Articles

Adding elements in a vector in R programming – append() method

Improve Article
Improve
Save Article
Save
Like Article
Like

append() method in R programming is used to append the different types of integer values into a vector in the last.

Syntax: append(x, value, index(optional))

Return: Returns the new vector after appending given value.

Example 1:




x <- rep(10:15) # Using rep() method gfg <- append(x, 1, 1) print(gfg)


Output:

[1]  1  2  3  4  5 10

Example 2:





Output:

[1] 10  1 11 12 13 14 15
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 10 May, 2020
Like Article
Save Article
Previous
Next
Similar Reads