From huber at ebi.ac.uk  Mon Feb 14 10:49:14 2005
From: huber at ebi.ac.uk (Wolfgang Huber)
Date: Mon Feb 14 11:50:05 2005
Subject: [Rd] sprintf - was formatC with illegal input crashes Rgui
	(PR#7686)
In-Reply-To: <Pine.LNX.4.61.0502140956020.29523@gannet.stats>
References: <20050211175824.5EB48DEE7@slim.kubism.ku.dk>
	<Pine.LNX.4.61.0502140956020.29523@gannet.stats>
Message-ID: <4210741A.8040606@ebi.ac.uk>

Dear Prof. Ripley,

Would it be possible to make sprintf accept vector arguments?
I.e. allow expressions like
   sprintf("%04d", 1:3)
to produce something like what currently needs to be done via
   sapply(1:3, function(i) sprintf("%04d",i))

   Best wishes
   Wolfgang
-------------------------------------
Wolfgang Huber
European Bioinformatics Institute
European Molecular Biology Laboratory
Cambridge CB10 1SD
England
Phone: +44 1223 494642
Fax:   +44 1223 494486
Http:  www.ebi.ac.uk/huber
-------------------------------------

Prof Brian Ripley wrote:
> We'll fix this, but you might like to note that sprintf is more
> bulletproof and as from 2.1.0-to-be, a lot more tolerant, e.g.
> 
> sprintf("%s", 1)
> 
> works there and in 2.0.1 gives a useful error message.
> 
> On Fri, 11 Feb 2005 ehlers@math.ucalgary.ca wrote:
> 
>> Full_Name: Peter Ehlers
>> Version: rw2001pat (2005-02-03)
>> OS: Win XP
>> Submission from: (NULL) (136.159.61.115)
>>
>>
>> formatC(1, flag="s") crashes Rgui.
>> Similarly for flag=[SnZ].
>> Stupid input, of course, but I'm error-prone.


[Rd] sprintf - was formatC with illegal input crashes Rgui (PR#7686)
Wolfgang Huber