Identifying rows in data.frame with only NA values in R

前端 未结 2 1425
孤独总比滥情好
孤独总比滥情好 2021-02-20 05:31

I have a data.frame with 15,000 observations of 34 ordinal and NA variables. I am performing clustering for a market segmentation study and need the ro

2条回答
  •  有刺的猬
    2021-02-20 05:58

    Using the Store2 sample data posted in the answer provided by @akrun

    which(apply(Store2, 1, function(x) all(is.na(x))))
    #3 4 
    #3 4 
    

    Or, similar to akrun's answer:

    which(rowSums(!is.na(Store2))==0)
    #3 4 
    #3 4 
    

提交回复
热议问题