0

I would like to find the text of the C++ code called by an R function, specifically, the function "_dplyr_summarise_impl" which is called by summarise_impl. Even more specifically, I would like to find the bit of code that precedes that which returns the error message"

Error in summarise_impl(.data, dots) :
Evaluation error: argument "yes" is missing, with no default.

I presume that the "yes" in the code above varies, but that it is supplied by some other bit of dplyr or the related tidyverse, as none of my code possess a "yes" argument to be missing. Or it might be base R code called by tidyverse code. But in either case, there is a gap between the error message and the last function I could see with traceback, caused, I am guessing, by traceback being unable to find its way through called C++ code. I am hypothesizing that if I can find the code that was supposed to supply the "yes" argument, that will tell me what is going wrong. But there is a gap between the last function that traceback supplies and the error message above. I am looking for help in bridging that gap.

It now appears to me that this is a standard error message for some version of eval, either base or tidyverse, that is called either by _dplyr_summarise_impl, or some function that it calls. Many, perhaps all, of the dplyr major verbs have an unexported function of the form <function>_impl, and all of these functions return error messages very similar to the one previously cited. So I suspect they may be calling a common error message process.

I just found the text of _dplyr_summarise_impl here, in dplyr/src/RcppExports.cpp. That takes me one step closer, but I don't know enough C++ to know which of these lines is most likely to be calling the function that calls the error. Guess I'll read the C++ chapter in Advanced R next.

// summarise_impl
SEXP summarise_impl(DataFrame df, QuosureList dots);
RcppExport SEXP _dplyr_summarise_impl(SEXP dfSEXP, SEXP dotsSEXP) {
BEGIN_RCPP
    Rcpp::RObject rcpp_result_gen;
    Rcpp::RNGScope rcpp_rngScope_gen;
    Rcpp::traits::input_parameter< DataFrame >::type df(dfSEXP);
    Rcpp::traits::input_parameter< QuosureList >::type dots(dotsSEXP);
    rcpp_result_gen = Rcpp::wrap(summarise_impl(df, dots));
    return rcpp_result_gen;
END_RCPP
} 
andrewH
  • 2,281
  • 2
  • 22
  • 32
  • You can search (easily) at GitHub, which I just did. It finds said function in five repos which seem to be copies of (an older version of) `dplyr`. The error, though, may also come from the R side when you call an R function with insufficient arguments. – Dirk Eddelbuettel Dec 26 '17 at 20:47
  • Hi, Dirk, thanks! I had searched github with various combinations of fragments of the error message, with no useful results, but your comment caused me to go back and search again, using the function name _dplyr_summarise_impl, and find the function text above. When a traceback terminates in a C++ function call, can you tell me what tool or tools you recommend for further debugging? I am working in a Windows 10/RStudio environment. And I just ordered your book. – andrewH Dec 27 '17 at 21:29
  • No step back and find (in `R/RcppExports.R`) the R function calling this. I suspect you simply have an issue _with its arguments_ and R catches you there. – Dirk Eddelbuettel Dec 27 '17 at 21:44

0 Answers0