[R-pkg-devel] How ton print in the console from Rcpp

Elysée Aristide @r|e|92@nd @end|ng |rom gm@||@com
Thu Oct 20 15:16:13 CEST 2022


Thank you very much for your answers.

I finally noticed that the issue comes from the numerical optimization, in which I use the class MFuncGrad of the package RcppNumerical. Is there any problem in using this class? This is the only way I know to compute integrals of perform numerical optimizations in Rcpp. The other way might be: construct the function to be minimized in Rcpp and use the function optim in R. But this is not efficient.

Best,
Aristide
________________________________
From: Dirk Eddelbuettel <edd using debian.org>
Sent: Thursday, October 20, 2022 2:42:23 PM
To: Ivan Krylov <krylov.r00t using gmail.com>
Cc: Elys��e Aristide <ariel92and using gmail.com>; r-package-devel using r-project.org <r-package-devel using r-project.org>
Subject: Re: [R-pkg-devel] How ton print in the console from Rcpp


On 20 October 2022 at 14:46, Ivan Krylov wrote:
| �� Thu, 20 Oct 2022 12:43:30 +0200
| Elys��e Aristide <ariel92and using gmail.com> ��ڧ�֧�:
|
| > What I understood is that it is better to use Rcpp functions. So I
| > used:
| >
| > Rcpp::Rcout << "beta: \n";
| > Rcpp::print(betacpp);
| > Rcpp::Rcout << "log-likelihood: " << llh << "\n";
|
| This seems to be a right way of printing from Rcpp code.

Yup!

And as stated that alone does not cause `__assert_rtn` or many of the now
almost 2600 Rcpp-using packages (that print this way) would have issues.

Dirk

--
dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list