The following code will filter a table of isotope combinations to identify combinations where only one element is isotopically enriched.
df <- tibble::tibble(
C12 = rep(c(2:0), 2),
C13 = rep(c(0:2), 2),
H1 = rep(c(0, 1), each = 3),
H2 = rep(c(1, 0), each = 3)
)
element_filter <- "H2"
dplyr::filter_at(df, dplyr::vars(element_filter), dplyr::all_vars(. == 0))
I would like to include this code in a package and avoid the no visible binding for global variable ‘.’
warning. When I change the filter_at
call to
dplyr::filter_at(df, dplyr::vars(element_filter), dplyr::all_vars(.data == 0))
I receive the following error, Error: (list) object cannot be coerced to type 'double'
. I am successfully using the .data
pronoun in other functions, but am unable to figure out how to get it working here. Appreciate the help.