We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c651d91 commit 20fc7b1Copy full SHA for 20fc7b1
src/utils.c
@@ -633,11 +633,14 @@ SEXP frev(SEXP x, SEXP copyArg) {
633
names = PROTECT(getAttrib(x, R_NamesSymbol));
634
nprotect++;
635
if (copy) {
636
+ SEXP klass = PROTECT(getAttrib(x, R_ClassSymbol));
637
+ SEXP levels = PROTECT(getAttrib(x, R_LevelsSymbol));
638
+ nprotect += 2;
639
+ // swipe attributes from x
640
SET_ATTRIB(x, R_NilValue);
641
setAttrib(x, R_NamesSymbol, names);
- setAttrib(x, R_ClassSymbol, PROTECT(getAttrib(x, R_ClassSymbol)));
- setAttrib(x, R_LevelsSymbol, PROTECT(getAttrib(x, R_LevelsSymbol)));
- nprotect += 2;
642
+ setAttrib(x, R_ClassSymbol, klass);
643
+ setAttrib(x, R_LevelsSymbol, levels);
644
}
645
if (!isNull(names)) {
646
frev(names, ScalarLogical(FALSE));
0 commit comments