@@ -610,20 +610,11 @@ SEXP getvarcols(SEXP DT, SEXP dtnames, Rboolean varfactor, Rboolean verbose, str
610610 } else {
611611 // same behavior for vector measure.vars: variable is column names
612612 SET_VECTOR_ELT (ansvars , 0 , target = allocVector (STRSXP , data -> totlen ));
613- if (data -> lvalues == 1 ) {
614- const int * thisvaluecols = INTEGER (VECTOR_ELT (data -> valuecols , 0 ));
615- for (int j = 0 , ansloc = 0 ; j < data -> lmax ; ++ j ) {
616- const int thislen = data -> narm ? length (VECTOR_ELT (data -> not_NA_indices , j )) : data -> nrow ;
617- SEXP str = STRING_ELT (dtnames , thisvaluecols [j ]- 1 );
618- for (int k = 0 ; k < thislen ; ++ k ) SET_STRING_ELT (target , ansloc ++ , str );
619- }
620- } else {//multiple value columns to output.
621- for (int j = 0 , ansloc = 0 , level = 1 ; j < data -> lmax ; ++ j ) {
622- const int thislen = data -> narm ? length (VECTOR_ELT (data -> not_NA_indices , j )) : data -> nrow ;
623- char buff [20 ];
624- snprintf (buff , sizeof (buff ), "%d" , level ++ ); // # notranslate
625- for (int k = 0 ; k < thislen ; ++ k ) SET_STRING_ELT (target , ansloc ++ , mkChar (buff ));
626- }
613+ const int * thisvaluecols = INTEGER (VECTOR_ELT (data -> valuecols , 0 ));
614+ for (int j = 0 , ansloc = 0 ; j < data -> lmax ; ++ j ) {
615+ const int thislen = data -> narm ? length (VECTOR_ELT (data -> not_NA_indices , j )) : data -> nrow ;
616+ SEXP str = STRING_ELT (dtnames , thisvaluecols [j ]- 1 );
617+ for (int k = 0 ; k < thislen ; ++ k ) SET_STRING_ELT (target , ansloc ++ , str );
627618 }
628619 }
629620 } else {// varfactor==TRUE
0 commit comments