[Rd] StringFromInteger made private in r38652
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Aug 8 08:35:28 CEST 2006
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.
On Mon, 7 Aug 2006, Seth Falcon wrote:
> Hi,
>
> In commit 38652, StringFromInteger (among others) was removed from R's
> public API. I've just come across a Bioconductor package, RdbiPgSql,
> that uses this function.
>
> Is there an alternative that is in the public API? If not, it would
> be nice to be able to reuse these sorts of helper functions
> (StringFrom*) instead of reimplementing them for each package.
>
> + seth
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel
mailing list