I have a matrix as such:
A B C D
1 4 5 NA
43 3 NA NA
85 NA 43 NA
4 2 NA NA
I am trying to figure out how to count the number of non empty columns (In this case it would = 3). However if I do ncol(df) I get 4. How can I count only the columns that are not completely empty (idealy with base R or Tidyverse (trying not to use too many imported packages)?