R – Create Empty Data Frame

To create an empty Data Frame in R, call data.frame() function, and pas no arguments to it. The function returns an empty Data Frame with zero rows and zero columns.

Syntax

The syntax to create an empty R Data Frame using data.frame() is

</>
Copy
df <- data.frame()

Example

In this example, we create an empty R Data Frame df using data.frame() function. Then, we print this empty Data Frame to console.

example.R

</>
Copy
df <- data.frame()
print(df)

Output

data frame with 0 columns and 0 rows

Conclusion

In this R Tutorial, we learned to create an empty R Data Frame using data.frame(), with the help of example program.