Re: [R] String manipulation and formatting

From: Bashir Saghir (Aztek Global) <Saghir.Bashir_at_ucb-group.com>
Date: Tue 18 Jul 2006 - 00:51:16 EST


Thanks! I tried something similar but I had sep="" instead of collapse="" for the X part. I realise the error now.

Thanks again
Saghir

-----Original Message-----
From: Christos Hatzis [mailto:christos@nuverabio.com] Sent: Monday, July 17, 2006 16:39
To: Bashir Saghir (Aztek Global); r-help@R-project.org Subject: RE: [R] String manipulation and formatting

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:Saghir.Bashir@UCB-Group.com] Sent: Monday, July 17, 2006 10:39 AM
To: 'christos@nuverabio.com'; r-help@R-project.org 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:christos@nuverabio.com
<mailto:christos@nuverabio.com> ]
Sent: Monday, July 17, 2006 16:21
To: Bashir Saghir (Aztek Global); r-help@R-project.org 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: r-help-bounces@stat.math.ethz.ch
[mailto:r-help-bounces@stat.math.ethz.ch
<mailto:r-help-bounces@stat.math.ethz.ch> ] On Behalf Of Bashir Saghir
(Aztek
Global)
Sent: Monday, July 17, 2006 10:07 AM
To: 'r-help@R-project.org'
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
<https://stat.ethz.ch/mailman/listinfo/r-help>
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
<http://www.R-project.org/posting-guide.html>


Legal Notice: This electronic mail and its attachments are intended solely for the person(s) to whom they are addressed and contain information which is confidential or otherwise protected from disclosure, except for the purpose for which they are intended. Dissemination, distribution, or reproduction by anyone other than the intended recipients is prohibited and may be illegal. If you are not an intended recipient, please immediately inform the sender and return the electronic mail and its attachments and destroy any copies which may be in your possession. UCB screens electronic mails for viruses but does not warrant that this electronic mail is free of any viruses. UCB accepts no liability for any damage caused by any virus transmitted by this electronic mail.


Legal Notice: This electronic mail and its attachments are intended solely for the person(s) to whom they are addressed and contain information which is confidential or otherwise protected from disclosure, except for the purpose for which they are intended. Dissemination, distribution, or reproduction by anyone other than the intended recipients is prohibited and may be illegal. If you are not an intended recipient, please immediately inform the sender and return the electronic mail and its attachments and destroy any copies which may be in your possession. UCB screens electronic mails for viruses but does not warrant that this electronic mail is free of any viruses. UCB accepts no liability for any damage caused by any virus transmitted by this electronic mail.

        [[alternative HTML version deleted]]



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 Received on Tue Jul 18 00:47:32 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 18 Jul 2006 - 02:19:41 EST.

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