[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 12:43:30 CEST 2022
Greetings,
In my CDatanet package, I want to print texts and values during a numerical
optimization process. I saw in many posts that CRAN is not happy with
sd::cout and sd::endl. 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";
Everything is fine with the check --as-cran with Linux and Windows.
However, there is a warning with Mac (
https://www.r-project.org/nosvn/R.check/r-release-macos-arm64/CDatanet-00check.html
)
checking compiled code ... WARNING
File ‘CDatanet/libs/CDatanet.so’:
Found ‘___assert_rtn’, possibly from ‘assert’ (C)
Objects: ‘CDincomInfo.o’, ‘CDincomInfo.rho.o’, ‘Homophily.o’,
‘RcppExports.o’, ‘SARTIncomplet.o’
Compiled code should not call entry points which might terminate R nor
write to stdout/stderr instead of to the console, nor use Fortran I/O
nor system RNGs.
I think this is because I am printing from C++ functions. Am I wrong? If
not, what is the best way to print in the console from C++ functions?
Best regards,
Aristide Elysée HOUNDETOUNGAN
*Assistant Professor of Economics*
*Website : *www.ahoundetoungan.com
[[alternative HTML version deleted]]
More information about the R-package-devel
mailing list