Prof Brian Ripley <[EMAIL PROTECTED]> writes:

> Those functions are messy (StringFromRaw was always private), and are 
> really just part of coerceVector and asInteger etc (which are the public 
> interface).
>
> What RdbiPgSql does is not currently correct.  It has
>
>   PROTECT(rowNames = allocVector(STRSXP, rows));
>   for (row = 0; row < rows; ++row)
>           SET_VECTOR_ELT(rowNames, row, StringFromInteger(row+1, NULL));
>
> but you should not be applying SET_VECTOR_ELT to a STRSXP.  The intended 
> effect is obtained by
>
>    PROTECT(rowNum = allocVector(INTSXP, rows));
>    irow = INTEGER(rowNum);
>    for(row = 0; row < rows; row++) irow[row] = row+1;
>    PROTECT(rowNames = coerceVector(rowNames, STRSXP));
>
> (in R terms, as.character(1:row)).  However, in R-devel, you can make use 
> of the space-optimized versions of row.names, so you don't need the 
> coercion and would be better off without it.
>
> Finally, this is done unconditionally, but only used if matrix ==
> FALSE.

Thanks for the clarification and example.  I will make sure RdbiPgSql
gets fixed.

+ seth

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to