View source: R/group_by_coalesce.R
| group_by_coalesce | R Documentation | 
Groups by and coalesces the remaining columns such that only one value is returned per column. If multiple values are present that are not NA a warning is returned with the offending group, column name, and values.
group_by_coalesce(.data, ..., .ignore = c(), .method = "first", debug = FALSE)
.data | 
 A data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr).  | 
... | 
 one or more unquoted expressions separated by commas. Variable names can be used as if they were positions in the data frame, so expressions like x:y can be used to select a range of variable  | 
.ignore | 
 which columns to ignore for warnings  | 
.method | 
 either 'first' or 'sum'  | 
debug | 
 logical, print debug statements  | 
vector of coalesced values
df_safe <- data.frame(
    A=c(1,1,2,2,2),
    B=c(NA,2,NA,NA,4),
    C=c(3,NA,NA,5,NA),
    D=c(NA,2,3,NA,NA),
    E=c(NA,NA,NA,4,NA))
df_warn <- data.frame(
    A=c(1,1,2,2,2),
    B=c(NA,2,NA,4,4),
    C=c(3,NA,NA,5,NA),
    D=c(NA,2,3,NA,NA),
    E=c(NA,NA,NA,4,5))
group_by_coalesce(df_safe, A)
group_by_coalesce(df_warn, A)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.