Remove Empty Rows of Data Frame in R (2 Examples) | apply, all, rowSums, is.na & ncol Functions

preview_player
Показать описание
R code of this video:

x2 = c("a", "", "b", "c", "d"))

data1[!apply(data1 == "", 1, all), ] # Remove rows with only empty cells

x2 = c("a", NA, "b", "c", "d"))

Follow me on Social Media:
Рекомендации по теме
Комментарии
Автор

Nice one👍💪.
Thank you Joachim!! Much more precise than rm.na= TRUE

agsoutas
Автор

Still a newbie but I tried using this code with a tibble (I changed "data1" into "tibble1" by replacing "data.frame()" with "tibble()") and I can't get it to work. Is the code to remove a row in the video just for base R stuff?

monkeyofwar
Автор

Please help me one query, as I have a excel sheet in which filter by some conditions and after that I want to copy only that filtered data and paste in new excel work sheet.

SudhirKumar-rygk
Автор

How deal with empty/blank cell in a particular column of a data set with R ?

sudiptomitra
Автор

Great video Joachim. Question, how would I remove the entire row, if even one of the columns contained blank / missing data? In other words, not just the rows with everything missing / NA.

robertdeering