How to create a empty vector with fixed length in R

r
datastructure

#1

How to create a empty vector with fixed length in R??
for example I want to create a empty vector of numeric with length of 10 ?


How to generate the vector of fixed length in R
#2

?vector holds the answer.

vector(mode = "logical", length = 0). (Change mode and length with your preference)

Of course, it won’t create a truly “empty” vector - just one with default values inserted based upon mode’s value.