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 |
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.