How to remove empty rows from R dataframe?
A dataframe can contain empty rows and here with empty rows we don’t mean NA, NaN or 0, it literally means empty with absolutely no data. Such rows are obviously wasting space and making data frame unnecessarily large. This article will discuss how can this be done.
To remove rows with empty cells we have a syntax in the R language, which makes it easier for the user to remove as many numbers of empty rows in the data frame automatically.
data <- data[!apply(data == “”, 1, all),]
- Create dataframe
- Select empty rows
- Remove those rows
- Copy the resultant dataframe
- Display dataframe
My Personal Notes arrow_drop_up
Please Login to comment...