Home > Software engineering >  NA value in mean?
NA value in mean?

Time:12-16

Whenever I use
df %>% remove_empty(c("rows", "cols")) and then take mean of df using 
 df %>%
    summarise(mean= mean(value),
            sd= sd(value),
            n = length(value)) 
I get mean= NA sd=NA  n= 2000

However, when I use this code: print(mean(df$value, na.rm= TRUE)) mean= 1.23(..)

Why is this happening?

Like above, I'm not sure why this is occuring. Thanks

CodePudding user response:

remove_empty only removes rows or columns which are entirely made of NA values. Rows/columns which only have some NA values are not removed.

  • Related