double()

It is used to create a double vector of 0 length.

Syntax:

vector = double()  

Example: R program to create a double vector of 0 length and display

R




# double vector of 0 length
vector = double()       
  
# display
print(vector)        


Output:

numeric(0)

How to Create a Vector of Zero Length in R

In this article, we are going to discuss how to create a vector of zero length in R programming language.

We can create a vector of zero length by passing the datatype as a value to the vector.

Syntax:

vector=datatype()

There are six data types and each can be used to create a vector of the required datatype. Let’s see how to create a vector of 0 length of each data type.

Similar Reads

character()

It is used to create a Numeric vector of 0 length....

factor()

...

logical()

It is used to create a Factor vector of 0 length...

integer()

...

double()

It is used to create a logical vector of 0 length....

raw()

...

complex()

It is used to create an Integer vector of 0 length....