Named vectors
📖 Scenario: Imagine you are organizing a small fruit basket. You want to keep track of the number of each fruit you have, and give each count a name so you can easily find it later.
🎯 Goal: You will create a named vector in R where each fruit name is linked to its quantity. Then, you will access and display this information.
📋 What You'll Learn
Create a numeric vector with exact quantities for fruits
Assign names to each element in the vector matching the fruit names
Access the vector elements by their names
Print the named vector to show the fruit quantities
💡 Why This Matters
🌍 Real World
Named vectors help you label data clearly, like keeping track of items in a basket or inventory.
💼 Career
Understanding named vectors is useful in data analysis and programming jobs where you work with labeled data.
Progress0 / 4 steps