Determine the number of NA values in a column

后端 未结 14 1481
眼角桃花
眼角桃花 2020-12-02 04:17

I want to count the number of NA values in a data frame column. Say my data frame is called df, and the name of the column I am considering is

14条回答
  •  天涯浪人
    2020-12-02 04:33

    This form, slightly changed from Kevin Ogoros's one:

    na_count <-function (x) sapply(x, function(y) sum(is.na(y)))
    

    returns NA counts as named int array

提交回复
热议问题