Name the Elements Of a Vector in R

Problem:
Naming the elements of a Vector
Solution:
To give a name to the elements of a vector, we can use the names() function.
For example,

This code first creates a vector named “employee” and then gives the two elements a name. The first element is the “Name” and the second element is named as “Department”. The above piece of code gives the output as below:
You may also like:
Thank You for reading!
0

Leave a Reply

Your email address will not be published. Required fields are marked *