Skip to content

Instantly share code, notes, and snippets.

@CGMossa
CGMossa / plogis_binomial_linkinv.C
Last active March 15, 2024 11:05
There is a performance difference between invoking plogis(x) vs. binomial()$loglink(x), according to https://twitter.com/noah_greifer/status/1768505576143659132.
static const double MTHRESH = -30.;
SEXP logit_linkinv(SEXP eta)
{
SEXP ans = PROTECT(shallow_duplicate(eta));
int i, n = LENGTH(eta);
double *rans = REAL(ans), *reta = REAL(eta);
if (!n || !isReal(eta))
error(_("Argument %s must be a nonempty numeric vector"), "eta");
@CGMossa
CGMossa / config.toml
Created February 27, 2023 23:06
Working with libR-sys requires files like these
[env]
LIBCLANG_PATH = "C:/Users/angus/scoop/apps/llvm/current/lib"
RUST_BACKTRACE = "full"
LIBRSYS_BINDINGS_OUTPUT_PATH = "mybindings"
R_HOME = "C:/Users/angus/scoop/apps/R/current"
[build]
target-dir = "target"
# target = "x86_64-pc-windows-msvc"
# target = "x86_64-pc-windows-gnu"
_R_CHECK_TESTS_NLINES_=0
__R_CHECK_LENGTH_1_CONDITION_=verbose
__R_CHECK_LENGTH_1_LOGIC2_=vebose
_R_CHECK_TESTS_NLINES_=0
__R_CHECK_LENGTH_1_CONDITION_=verbose
__R_CHECK_LENGTH_1_LOGIC2_=vebose
@CGMossa
CGMossa / .Rprofile
Last active February 11, 2020 17:34
#TODO: Find a way to restart R without using this particular .Rprofile.
#
# CLEAN_SESSION <- TRUE
CLEAN_SESSION <- FALSE
if (interactive() && !CLEAN_SESSION) {
# Configure session -------------------------------------------------------
message("Interactive mode configuration")