- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create an empty data frame in R?
We can create an empty data frame as follows −
> df <- data.frame(Income=double(), Age=integer(), EducationLevel=factor(), MaritalStatus=logical(), StateLiving=character(), stringsAsFactors=FALSE) > str(df) 'data.frame': 0 obs. of 5 variables: $ Income : num $ Age : int $ EducationLevel: Factor w/ 0 levels: $ MaritalStatus : logi $ StateLiving : chr
We can edit this data frame by using −
> edit(df)
This edit command will open a spreadsheet and we can enter the data in the data frame.
- Related Articles
- How to remove empty rows from an R data frame?
- How to convert empty values to NA in an R data frame?
- How to create an empty data frame with fixed number of rows and without columns in R?
- How to create a group column in an R data frame?
- How to create a lagged column in an R data frame?
- How to create an empty matrix in R?
- How to create histogram of all columns in an R data frame?
- How to create scatterplot for factor levels in an R data frame?
- How to create histogram for discrete column in an R data frame?
- How to find the number of non-empty values in an R data frame column?
- How to convert an old data frame to new data frame in R?
- How to create a column in an R data frame with cumulative sum?
- How to create a blank column with randomization in an R data frame?
- How to create table of two factor columns in an R data frame?
- How to create barplot for some top values in an R data frame?

Advertisements