Re: [R] how to generate sequence a - z

2008-01-29 Thread Barry Rowlingson
Bernd Weiss wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 skestin schrieb:
 | I suppose it's very simple but I can't find the way to generate a
 sequence of
 | characters, e.g. from a to z.
 | Could you please help me with this?
 
 ?letters
 letters
 

  letters is okay for just that sequence, or parts of it, but might 
not be general enough for the original poster...

  I just discovered 'charToInt' and 'intToChar' in the R.oo package:

   intToChar(65:68)
  [1] A B C D

  Then you can define cseq:

   cseq =
  function(from,to,by=1){
  from=charToInt(from)
  to=charToInt(to)
  intToChar(seq(from,to,by))
  }

  and do:
   cseq('A','G')
   [1] A B C D E F G
   cseq('A','G',2)
   [1] A C E G
   cseq('a','A',-2)
   [1] a _ ] [ Y W U S Q O M K I G E C A

  Note this uses ASCII codes and not whatever your language alphabet is.

  I'd overload ':' for this and then you could do 'a':'z', but ':' heads 
into .Primitive territory...

Barry

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to generate sequence a - z

2008-01-29 Thread Duncan Murdoch

On 1/29/2008 7:39 AM, skestin wrote:

I suppose it's very simple but I can't find the way to generate a sequence of
characters, e.g. from a to z.
Could you please help me with this?


If you want the standard collation sequence, use the letters variable, 
as others have said.


If you want the sequence that applies in your locale (where does ü 
fall?), it's harder.  I don't know a simple way, but this gives you 
collation order in the German locale in Windows:


 x - as.raw(32:255)
 y - readChar(x, rep(1, 224))
 Sys.setlocale(LC_COLLATE, German)
[1] German_Germany.1252
 sort(y)
  [1] \177 �����'-­–
 [11] —  !\   #$%(
 [21] )*,./:;?@[
 [31] \\   ]^ˆ_`{|}~
 [41] ¡¦¨¯´¸¿˜‘’
 [51] ‚“”„‹›+=
 [61] ±«»×÷¢£¤¥§
 [71] ©¬®°µ¶·†‡•
 [81] …‰€0¼½¾1¹2
 [91] ²3³456789a
[101] AªáÁàÀâÂäÄ
[111] ãÃåÅæÆbBcC
[121] çÇdDðÐeEéÉ
[131] èÈêÊëËfFƒg
[141] GhHiIíÍìÌî
[151] ÎïÏjJkKlLm
[161] MnNñÑoOºóÓ
[171] òÒôÔöÖõÕøØ
[181] œŒpPqQrRsS
[191] šŠßtTþÞ™uU
[201] úÚùÙûÛüÜvV
[211] wWxXyYýÝÿŸ
[221] zZžŽ

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to generate sequence a - z

2008-01-29 Thread Attiglah, Mama

 letters
 [1] a b c d e f g h i j k l m n o p q
r s t u v w x y z
 LETTERS
 [1] A B C D E F G H I J K L M N O P Q
R S T U V W X Y Z

Hope that will help.

Mama 

-
Mama Attiglah, PhD
Advanced Research Center
Quantitative Research Analyst
State Street Bank
+44(0)20 7698 6290 (Direct Line)
+44 (0)207 004 2968 (Direct Fax)
Please visit our Web site at 
www.ssga.com

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Bernd Weiss
Sent: 29 January 2008 12:43
To: skestin; [EMAIL PROTECTED]
Subject: Re: [R] how to generate sequence a - z

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

skestin schrieb:
| I suppose it's very simple but I can't find the way to generate a
sequence of
| characters, e.g. from a to z.
| Could you please help me with this?

?letters
letters


HTH,

B.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHnx9IUsbvfbd00+ERAuasAKCYIZ9KC4c3NoDFfkdDP0MyZckinwCbBQv7
CX249me9JFbVlWNPy/mDtV0=
=Vaea
-END PGP SIGNATURE-

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] how to generate sequence a - z

2008-01-29 Thread skestin

I suppose it's very simple but I can't find the way to generate a sequence of
characters, e.g. from a to z.
Could you please help me with this?
-- 
View this message in context: 
http://www.nabble.com/how-to-generate-sequence-%22a%22---%22z%22-tp15158509p15158509.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to generate sequence a - z

2008-01-29 Thread Bernd Weiss
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

skestin schrieb:
| I suppose it's very simple but I can't find the way to generate a
sequence of
| characters, e.g. from a to z.
| Could you please help me with this?

?letters
letters


HTH,

B.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHnx9IUsbvfbd00+ERAuasAKCYIZ9KC4c3NoDFfkdDP0MyZckinwCbBQv7
CX249me9JFbVlWNPy/mDtV0=
=Vaea
-END PGP SIGNATURE-

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to generate sequence a - z

2008-01-29 Thread Christoph Scherber
--
X-USF-Spam-Status: hits=-2.6 tests=BAYES_00
X-USF-Spam-Flag: NO

Hello,

Sequences of letters can be generated by typing

LETTERS #for capital letters or
letters #for small letters

Best wishes
Christoph



skestin schrieb:
 I suppose it's very simple but I can't find the way to generate a sequence of
 characters, e.g. from a to z.
 Could you please help me with this?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.