Remove Rows with Any Zero in R (Example) | How to Delete Row with 0 | Using apply & all Functions

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

x2 = c(3, 1, 0, 2, 2, 7),
x3 = 5,
x4 = c(9, 0, 9, 9, 9, 0))

data_zero <- data[apply(data, 1, function(row) all(row !=0 )), ] # Remove zero-rows

Follow me on Social Media:

Рекомендации по теме
Комментарии
Автор

Thanks for the tutorial, Joachim🙂. I will try at some point to do the same with dplyr's filter function.

agsoutas
Автор

Thank you
What is it like for a specific column?

rebwarjahani
Автор

What if I want to remove rows that contains only zeros

Not rows that has at least one zero in it

mantonaldo
welcome to shbcf.ru