[Rd] formatC(character()) returns length 1 result, but is documented otherwise
m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Wed Sep 22 12:46:58 CEST 2021
>>>>> Davis Vaughan
>>>>> on Mon, 13 Sep 2021 16:35:47 -0400 writes:
> Hi all,
> I believe I have either found a small bug, or a possible inconsistency in
> documentation. formatC() returns a length 1 result if given a length 0
> character() as input.
> #>  ""
> But the return value documentation states that it returns: "A character
> object of same size and attributes as x".
> I'd love for this to return a size 0 result here, consistent with the docs
> and my mental model of size stability for this function.
> Here is where this happens (it is explicitly hard coded):
> Davis Vaughan
> [[alternative HTML version deleted]]
This may well be a "historical artefact" - definitely
older than R 1.0.0. ... and yes I've known much less about S and
its new dialect R, back in 1998. ;-)
You are right in all you say, and my mental model corresponds to
yours, so we will almost surely change this (for R-devel;
possibly even consider "back" porting to R 4.1.1 patched).
Thank you for the report and suggestion,
More information about the R-devel