Re: [Rd] Argument recycling in substring()

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Fri, 04 Jun 2010 15:40:10 +0530

2010/6/4 Martin Maechler <maechler_at_stat.math.ethz.ch>:
>>>>>> "HP" == Hervé Pagès <hpages_at_fhcrc.org>
>>>>>>     on Thu, 03 Jun 2010 17:53:33 -0700 writes:
>
>    HP> Hi,
>    HP> According to its man page substring() "expands (its) arguments
>    HP> cyclically to the length of the longest _provided_ none are of
>    HP> zero length".
>
>    HP> So, as expected, I get an error here:
>
>    >> substring("abcd", first=2L, last=integer(0))
>    HP> Error in substring("abcd", first = 2L, last = integer(0)) :
>    HP> invalid substring argument(s)
>
>    HP> But I don't get one here:
>
>    >> substring(character(0), first=1:2, last=3L)
>    HP> character(0)
>
>    HP> which is unexpected.
> according to the docu.
>
> My gut feeling would say that the documentation should be
> updated in this case, rather than the implementation.
>
> RFC! other opinions?

I agree. The current behaviour is reasonable.

-Deepayan



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri 04 Jun 2010 - 10:21:41 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 04 Jun 2010 - 11:30:56 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive