Ok.  You needed the format string.  
 
xify(4.1) would be equivalent to the following:
 
paste(paste(rep("X",4),collapse=""),paste(rep("X",1),collapse=""),sep=".")
 
It should be straightforward to write the wrapper function for this.
 
HTH.
 
-Christos

  _____  

From: Bashir Saghir (Aztek Global) [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 17, 2006 10:39 AM
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: [R] String manipulation and formatting



Thanks. 

I should have been clearer. The output is the string "XXX.XX" and "XXX". 

So xify(4.1) should produce "XXX.X" as character string. 

Any pointers? Or did I miss something with formatC? 

-----Original Message----- 
From: Christos Hatzis [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 17, 2006 16:21 
To: Bashir Saghir (Aztek Global); [EMAIL PROTECTED] 
Subject: RE: [R] String manipulation and formatting 


See ?formatC 

You might need to write a simple wrapper function to implement the interface

that you want. 

-Christos 

-----Original Message----- 
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Bashir Saghir (Aztek 
Global) 
Sent: Monday, July 17, 2006 10:07 AM 
To: '[EMAIL PROTECTED]' 
Subject: [R] String manipulation and formatting 

I'm trying to write a simple function that does the following: 

  [command] xify(5.2) 
  [output] XXX.XX 

  [command] xify(3) 
  [output] XXX 

Any simple solutions (without using python/perl/unix script/...)? 

Thanks, 
Saghir 


--------------------------------------------------------- 
Legal Notice: This electronic mail and its attachments are i...{{dropped}}

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to