KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Say I have a vector, for example, x <- 1:10 , then x[0] returns a zero-length vector of the same class as x , here integer(0) . I was wondering if there is a reason behind that choice, as opposed to throwing an error, or returning NA as x[11] would? Also, if you can think of a situation where having x[0] return integer(0) is useful, thank you for including it in your answer.
Tags (comma-separated)
Save Edits
Cancel