Possible Duplicate:
Removing empty rows of a data file in R可能重复:删除R中数据文件的空行
Suppose I have a dataframe df
假设我有一个数据帧df
I would like to select the rows from it, where any of the variables in the row are not NA
. That is to say I only want to exclude the rows in which all the variables are NA
我想从中选择行,其中行中的任何变量都不是NA。也就是说我只想排除所有变量都是NA的行
1 个解决方案
#1
12
df[apply(!is.na(df), 1, any), ]
#1
12
df[apply(!is.na(df), 1, any), ]