You can use this
mydf %>% group_by(col_1) %>% summarise(non_na_count = sum(!is.na(col_2)))
# A tibble: 2 x 2
col_1 non_na_count
<fctr> <int>
1 A 1
2 B 2
More Related Contents:
- Relative frequencies / proportions with dplyr
- How to number/label data-table by group-number from group_by?
- Finding percentage in a sub-group using group_by and summarise
- Count number of rows by group using dplyr
- dplyr issues when using group_by(multiple variables)
- Add a column with count of NAs and Mean
- dplyr – groupby on multiple columns using variable names
- How to replace empty string with NA in R dataframe?
- Filtering rows in R unexpectedly removes NAs when using subset or dplyr::filter
- How can I count the number of NAs per group?
- Replace values greater than zero with 1 in r
- How does one access the piped data.frame in dplyr::funs?
- Extract row corresponding to minimum value of a variable by group
- How to select the rows with maximum values in each group with dplyr? [duplicate]
- Filter multiple values on a string column in dplyr
- What does %>% function mean in R?
- aggregate methods treat missing values (NA) differently
- dplyr: how to reference columns by column index rather than column name using mutate?
- How to delete columns that contain ONLY NAs?
- Merge rows in a dataframe where the rows are disjoint and contain NAs
- Reshape from long to wide and create columns with binary value
- Find the most frequent value by row
- Randomly insert NAs into dataframe proportionaly
- Can dplyr join on multiple columns or composite key?
- Replace a value NA with the value from another column in R
- Apply a ggplot-function per group with dplyr and set title per group
- How to group by two columns in R
- Count unique values for every column
- Count number of non-NA values by group
- Override column types when importing data using readr::read_csv() when there are many columns