Exemplo n.º 1
0
void cRUtil::SetListVectSexp(cDVector* theVal, uint theNElt, SEXP &theSEXP)
{       mvNbProtect++ ;
        PROTECT(theSEXP = allocVector(VECSXP, theNElt)) ;
        for (register uint i = 0 ; i < theNElt ; i++)
        {       SEXP myAux  ;
                SetVectSexp(theVal[i], myAux) ;
                SET_VECTOR_ELT(theSEXP, i, myAux) ;
        }
}
Exemplo n.º 2
0
void cRUtil::SetListVectSexp(cDMatrix& theVal, SEXP &theSEXP)
{
        uint theNElt;

        theNElt = theVal.mNRow;

        PROTECT(theSEXP = allocVector(VECSXP, theNElt)) ;
        mvNbProtect++ ;
        for (uint i = 0 ; i < theNElt; i++)
        {
               SEXP myAux  ;
               SetVectSexp(theVal[i], theVal.mNCol, myAux) ;
               SET_VECTOR_ELT(theSEXP, i, myAux) ;
        }
}
Exemplo n.º 3
0
/*
* Fill a list of theNElt vectors of names given by theNames in a SEXP
*/
void cRUtil::SetListNamedVectSexp(cDVector* theVal, char** theNames, uint theNElt, SEXP &theSEXP)
{	mvNbProtect++;
	PROTECT(theSEXP = allocVector(VECSXP, theNElt));
	for (register uint i = 0; i < theNElt; i++)
	{	SEXP myAux;
		SetVectSexp(theVal[i], myAux);
		SET_VECTOR_ELT(theSEXP, i, myAux);
	}

	mvNbProtect++;
	SEXP myNames = PROTECT(allocVector(STRSXP, theNElt));
	for (register uint i = 0; i < theNElt; i++)
	{	SET_STRING_ELT(myNames, i, mkChar(theNames[i]));
	}
	setAttrib(theSEXP, R_NamesSymbol, myNames);
}