How to delete columns that contain ONLY NAs?

后端 未结 7 1099
走了就别回头了
走了就别回头了 2020-11-28 04:36

I have a data.frame containing some columns with all NA values, how can I delete them from the data.frame.

Can I use the function

na.omit(...) 


        
相关标签:
7条回答
  • 2020-11-28 05:04

    Another option with Filter

    Filter(function(x) !all(is.na(x)), df)
    

    NOTE: Data from @Simon O'Hanlon's post.

    0 讨论(0)
提交回复
热议问题