i

R Programming Complete Tutorial

R Vector Modification

In this section, first, we will learn how to combine two vectors then modify our vector elements.

Combining Vectors:

Our vector vc1 contains numeric values, and vc2 contains characters. If we combine them, the new vector will be in the type of character.

Modify vector element values:

We can modify the vector element using the indexing. If we assign 0 to the second position of the vector, it will replace the previous value of the 2nd position.    

We can even delete all the elements, just assigning NULL to the vector.