in r/src/materialize.c [141:179]
static void fill_vec_with_nulls(SEXP x, R_xlen_t offset, R_xlen_t len) {
if (nanoarrow_ptype_is_data_frame(x)) {
for (R_xlen_t i = 0; i < Rf_xlength(x); i++) {
fill_vec_with_nulls(VECTOR_ELT(x, i), offset, len);
}
return;
}
switch (TYPEOF(x)) {
case LGLSXP:
case INTSXP: {
int* values = INTEGER(x);
for (R_xlen_t i = 0; i < len; i++) {
values[offset + i] = NA_INTEGER;
}
return;
}
case REALSXP: {
double* values = REAL(x);
for (R_xlen_t i = 0; i < len; i++) {
values[offset + i] = NA_REAL;
}
return;
}
case STRSXP:
for (R_xlen_t i = 0; i < len; i++) {
SET_STRING_ELT(x, offset + i, NA_STRING);
}
return;
case VECSXP:
for (R_xlen_t i = 0; i < len; i++) {
SET_VECTOR_ELT(x, offset + i, R_NilValue);
}
return;
default:
Rf_error("Attempt to fill vector with nulls with unsupported type");
}
}