R - Producing Empty Vectors
You can use one of the following methods to create an empty vector in R:
- Create empty vector with length zero and no specific class
empty_vec <- vector()
- Create empty vector with length zero and a specific class
empty_vec <- numeric()
- Create empty vector with specific length
empty_vec <- rep(0, times=10)
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.