## Not run:
#
# cppFunction(
# 'int fibonacci(const int x) {
# if (x == 0) return(0);
# if (x == 1) return(1);
# return (fibonacci(x - 1)) + fibonacci(x - 2);
# }')
#
# cppFunction(depends = "RcppArmadillo",
# 'List fastLm(NumericVector yr, NumericMatrix Xr) {
#
# int n = Xr.nrow(), k = Xr.ncol();
#
# arma::mat X(Xr.begin(), n, k, false);
# arma::colvec y(yr.begin(), yr.size(), false);
#
# arma::colvec coef = arma::solve(X, y);
# arma::colvec resid = y - X*coef;
#
# double sig2 = arma::as_scalar(arma::trans(resid)*resid/(n-k) );
# arma::colvec stderrest = arma::sqrt(
# sig2 * arma::diagvec(arma::inv(arma::trans(X)*X)));
#
# return List::create(Named("coefficients") = coef,
# Named("stderr") = stderrest
# );
# }')
#
# cppFunction(plugins=c("cpp11"), '
# int useCpp11() {
# auto x = 10;
# return x;
# }')
#
# ## End(Not run)
Run the code above in your browser using DataCamp Workspace