I just want to count the NAs in the below columns using the summarize across function, not sure why it doesn't work..
Dataset = data.frame( A = c(1,2,3,NA), B = c(1,2,NA,NA), C = c(1,2,3,4) ) Dataset %>% summarize(across(c(A,B,C), count(is.na(.))))
I had tried ~count(is.na()) but doesn't seem to work.
Error: Problem with `summarise()` input `..1`. x no applicable method for 'count' applied to an object of class "logical"
Looks like the error message says R can't count the columns which became logical columns, so I tried this.
Dataset %>% summarize(across(c(A,B,C), ~count(is.na==TRUE)))
but still doesn't seem to work, any help would be great!