How to create an empty DataFrame in R ?
In this article, we are going to see how to create an empty DataFrame in R Programming Language. An empty data frame corresponds to the tabular structure where the axes are of length 0, that is it does not contain any data items.
Method 1: We first create a matrix with both rows and columns and then convert it to a data frame
A data frame and matrix are easily inter-convertible to each other, we first create a matrix with both rows and columns equivalent to 0 and then convert it to a data frame. The dimensions of the equivalent data frame are 0. Time complexity incurred in the creation of an empty data frame is O(1), since a constant time is required.
 "Data Frame" data frame with 0 columns and 0 rows  "Dimensions of data frame"  0 0
The data frame can also be created using this method, without specifying the column types. Naming the columns of a data frame is also optional. An empty vector can be passed as an argument in the data.frame method.
 "Empty dataframe"  C1 C2 C3 C4 C5 <0 rows> (or 0-length row.names)
Method 2: Assign the column with the empty vectors
An empty data frame can also be created with or without specifying the column names and column types to the data values contained within it. data.frame() method can be used to create a data frame, and we can assign the column with the empty vectors. Column type checking with zero rows is supported by the data frames, where in we define the data type of each column prior to its creation.
'data.frame': 0 obs. of 3 variables: $ Col1: num $ Col2: int $ Col3: chr
Column 1 of the data frame can support numeric values, Column 2 can support integer values, and Column 3 as character variable values.