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)