This is a good observation that led me to a valid C code (since it c()is a primitive function). Just share your observation with the code.
Both in the actual C code functiondo_c() that does this c()for R, and inside this function there is a section devoted to assign attributes to the output.
if (data.ans_nnames && data.ans_length > 0) {
PROTECT(data.ans_names = allocVector(STRSXP, data.ans_length));
data.ans_nnames = 0;
while (args != R_NilValue) {
struct NameData nameData;
nameData.seqno = 0;
nameData.count = 0;
NewExtractNames(CAR(args), R_NilValue, TAG(args), recurse, &data, &nameData);
args = CDR(args);
}
setAttrib(ans, R_NamesSymbol, data.ans_names);
UNPROTECT(1);
}
, NewExtractNames() - , , ,
, , , , .
, .