You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// TODO: expand subsetVector to accept 'rep=' and 'len=' so that subset and rep.int can be done in one step avoiding intermediate subset of first_each_group, and pass len=anslen which we know already
366
367
}
367
368
368
-
for (inti=0; i<ngans; ++i) {
369
-
SEXPtt=VECTOR_ELT(gans, i);
370
-
SEXPatt=getAttrib(tt, sym_gforce_dynamic); // how long the items are, we won't parallelize within column so we can sweep forwards
371
-
if (isNull(att)) {
372
-
// e.g. the mean in .(mean(colA), first(colB, n=2)); TODO test
// att can be i) empty lens vec in which case this ans col's shape is min(grpsize,w). If this matches the end result shape (i.e. all ans columns are the same, then no need to allocate copy)
377
-
// ii) presence of lens vec always needs a copy and pad? (or could loop it and test if the same since looping through ngrp is much faster than nrow vector)
caseVECSXP: DOGANS(SEXP, SEXPPTR_RO, ScalarLogical(NA_LOGICAL), SET_VECTOR_ELT(newcol,ansi++,val)) /* TODO: global replace ScalarLogical() with fixed constant R_NAValue, depending on R dependency */
413
-
default:
414
-
error(_("Type '%s' is not supported by gforce padding."), type2char(TYPEOF(tt)));
415
-
}
416
-
SET_VECTOR_ELT(ans, ngrpcol+i, newcol);
417
-
UNPROTECT(1); // newcol
418
-
}
369
+
// Now copy gans into ans like in dogropus
370
+
SEXPsource;
371
+
intthislen;
372
+
for (intj=0; j<ngans; ++j) {
373
+
source=VECTOR_ELT(gans,j);
374
+
thislen=length(source);
375
+
if (thislen!=anslen)
376
+
error(_("Supplied %d items for column %d which has %d rows. The RHS length must match the LHS length exactly. If you wish to 'recycle' the RHS please use rep() explicitly to make this intent clear to readers of your code."), thislen, ngrpcol+j, anslen);
377
+
// clear attributes
378
+
if (!isNull(getAttrib(source, sym_gforce_dynamic)))
0 commit comments