How to Create a Named Vector Object in R (Example Code)

In this R tutorial you’ll learn how to construct a named vector object.

Example: Applying setNames() Function to Create a Vector Object with Names

x <- setNames(11:16, LETTERS[1:6])    # Create named vector
x
#  A  B  C  D  E  F 
# 11 12 13 14 15 16

Related Tutorials & Further Resources

Have a look at the following R programming tutorials. They explain similar topics as this post.

Leave a Reply

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

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top