powered by
This function initializes a vector based on a specified type and size, with an optional initial value.
initV(typeFunc, x, initVal = NULL)
A vector of the specified type and size, optionally initialized with a value.
A character string indicating the type of the vector or a function to create the vector.
The length of the vector.
An optional initial value to fill the vector.
# Create a numeric vector of length 5 initV("numeric", 5) # Create a logical vector of length 3 initialized with TRUE initV("logical", 3, TRUE)
Run the code above in your browser using DataLab