It's Autumn! Prices fall like leaves! - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Introduction to lists
Accessing list elements
Unnamed lists
Working with lists
27. Caution: adding new members
Summary

Instruction

Yes, indeed, R didn't throw any errors. Instead, R expanded the list so that it contains 10 members in total. It modified the 10th member to contain the value you passed in. All other members between the 4th and 10th members were populated with a value of NULL because we did not define any members for those positions.

Remember: when adding new members using an index inside the double-bracket operator, you should always use an index of length(your_list) + 1. That way, you won't have any members populated with NULLs.

Exercise

Click Next exercise to continue.