jeffsocal/tidyproteomics

error in dplyr::summarise() in argument n = n() ! could not find function "n"

eschen42 opened this issue · 1 comments

When invoking

  prot_expression <-
    prot_normalized %>%
    tidyproteomics::expression(autism/control, .method = "limma")

my run terminates with this error:

Error in `dplyr::summarise()`: autism / control
ℹ In argument: `n = n()`.
ℹ In group 1: `identifier = "A0A024R216"`.
Caused by error in `n()`:
! could not find function "n"
Run `rlang::last_trace()` to see where the error occurred.
✖ .. expression::limma testing autism / control [601ms]
> rlang::last_trace()
<error/rlang_error>
Error in `dplyr::summarise()`:
ℹ In argument: `n = n()`.
ℹ In group 1: `identifier = "A0A024R216"`.
Caused by error in `n()`:
! could not find function "n"
---
Backtrace:
     ▆
  1. ├─base::source("~/src/fatemi3/autism/tidyprot_meta.R")
  2. │ ├─base::withVisible(eval(ei, envir))
  3. │ └─base::eval(ei, envir)
  4. │   └─base::eval(ei, envir)
  5. ├─prot_normalized %>% ... at fatemi3/autism/tidyprot_meta.R:559:3
  6. ├─tidyproteomics::expression(., autism/control, .method = "limma")
  7. │ └─data %>% expression_limma(experiment, control)
  8. ├─tidyproteomics:::expression_limma(., experiment, control)
  9. │ └─... %>% unlist()
 10. ├─base::unlist(.)
 11. ├─dplyr::select(., identifier)
 12. ├─dplyr::filter(., n > 1, min_group > 0)
 13. ├─dplyr::summarise(., min_group = min(n), n = n(), .groups = "drop")
 14. └─dplyr:::summarise.grouped_df(., min_group = min(n), n = n(), .groups = "drop")
 15.   └─dplyr:::summarise_cols(.data, dplyr_quosures(...), by, "summarise")
 16.     ├─base::withCallingHandlers(...)
 17.     └─dplyr:::map(quosures, summarise_eval_one, mask = mask)
 18.       └─base::lapply(.x, .f, ...)
 19.         └─dplyr (local) FUN(X[[i]], ...)
 20.           └─mask$eval_all_summarise(quo)
 21.             └─dplyr (local) eval()
Run rlang::last_trace(drop = FALSE) to see 4 hidden frames.

Yikes! Thanks for reporting the error. Pushing a code correction now to v1.7.4.