I have been successfully using the below piece of code for quite a while, but for some reason now it got broken. Although I haved loaded the very same packages as before. No changes to R or dplyr versions in the meantime.
It looks like that dplyr's top_n() function does not work with pipes anymore.
Does anyone have experience in resolving this error message please? Any help or hint is highly appreciated.
R: 3.6.1; dplyr: 0.8.3
df %>% group_by(ID) %>% top_n(1,MRP)
Traceback:
Error in as.list(x) : trying to get slot "matsin" from an object (class "quosures") that is not an S4 object
20.
as.list(x)
19.
splice(dot_call(capture_dots, frame_env = frame_env, named = named, ignore_empty = ignore_empty, unquote_names = unquote_names, homonyms = homonyms, check_assign = check_assign))
18.
FUN(X[[i]], ...)
17.
lapply(.x, .f, ...)
16.
map(syms, function(sym) { if (!is_symbol(sym)) { abort("Inputs to capture must be argument names") } ...
15.
endots(call = sys.call(), frame_env = parent.frame(), capture_arg = rlang_enquo, capture_dots = rlang_quos_interp, named = .named, ignore_empty = .ignore_empty, unquote_names = .unquote_names, homonyms = .homonyms, check_assign = .check_assign)
14.
enquos(...)
13.
quo_reduce(..., .op = op)
12.
all_exprs(!!!dots, .vectorised = TRUE)
11.
filter.tbl_df(x, top_n_rank({ { n } ...
10.
filter(x, top_n_rank({ { n } ...
9.
top_n(., 1, MRP)
8.
function_list[[k]](value)
7.
withVisible(function_list[[k]](value))
6.
freduce(value, `_function_list`)
5.
`_fseq`(`_lhs`)
4.
eval(quote(`_fseq`(`_lhs`)), env, env)
3.
eval(quote(`_fseq`(`_lhs`)), env, env)
2.
withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
1.
df %>% group_by(ID) %>% top_n(1,MRP)