R/test_rcpp.R

Defines functions test_rcpp

Documented in test_rcpp

globalVariables("add_c")
#' Rcpp test function
#'
#' A simple function to test whether Rcpp is installed and working.
#' @return Returns \code{TRUE} if everything is OK.
#' @export
test_rcpp = function() {
  Rcpp::cppFunction("
  int add_c(int x, int y) {
    return x + y;
  }
")
  if (add_c(1, 1) == 2) {
    message("Everything seems fine")
    return(TRUE)
  }
  return(FALSE)
}
jr-packages/efficientTutorial documentation built on Feb. 16, 2020, 7:05 p.m.