[Rd] Error in ?strsplit

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Oct 28 19:22:35 CEST 2005


Thanks, easy to correct.  We will explicitly say that a factor 'x' is 
erroneous.

On Fri, 28 Oct 2005, Marc Schwartz (via MN) wrote:

> Hi all,
>
> Came across an error in ?strsplit in the details section:
>
> Details:
>
>     Arguments 'x' and 'split' will be coerced to character, so you
>     will see uses with 'split = NULL' to mean 'split = character(0)',
>     including in the examples below.
>
>
> I caught myself trying to use strsplit() on a factor and the coercion on
> 'x' is not done.
>
>
> According to the ONEWS file, the coercion on 'x' was removed in 1.8.0:
>
>   o	strsplit(x, *) now preserves names() but won't work for
> 	non-character `x' anymore {formerly used as.character(x),
> 	destroying names(x)}.
>
>
> The function prototype is:
>
>> strsplit
> function (x, split, extended = TRUE, fixed = FALSE, perl = FALSE)
> .Internal(strsplit(x, as.character(split), as.logical(extended),
>    as.logical(fixed), as.logical(perl)))
> <environment: namespace:base>
>
>
> So 'split' is coerced, but not 'x'.
>
>
> This is on:
>
> Version 2.2.0 Patched (2005-10-27 r36070)
>
>
> A proposed patch is:
>
>
> --- strsplit.Rd 2005-10-06 07:50:36.000000000 -0500
> +++ strsplit.rev.Rd     2005-10-28 11:51:08.000000000 -0500
> @@ -37,7 +37,7 @@
>   contains the vector of splits of \code{x[i]}.
> }
> \details{
> -  Arguments \code{x} and \code{split} will be coerced to character, so
> +  Argument \code{split} will be coerced to character, so
>   you will see uses with \code{split = NULL} to mean
>   \code{split = character(0)}, including in the examples below.
>
>
>
> HTH,
>
> Marc Schwartz
>
> ______________________________________________
> 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