#include SEXP c_off_by_one(SEXP x) { for (int i = 1; i < Rf_length(x) + 1; ++i) /* oops, C uses 0-based indexing */ REAL(x)[i] = i * i; return x; }