[R] Thanks

Gabor Grothendieck ggrothendieck at myway.com
Wed Sep 8 05:24:09 CEST 2004


Gabor Grothendieck <ggrothendieck <at> myway.com> writes:

: 
: 孟欣 <xmeng <at> capitalbio.com> writes:
: 
: : Thanks a lot for your timely rely.
: : I still wonder whether I can use "a":"d" instead of 1:4.
: : I remember I fulfill it successfully according to the guidance of some 
: materials on R,but fail to find it now.
: 
: You could define your own seq function and operator:
: 
: R> "%:%" <- seq.character <- function(x,y) letters[letters >= x & letters <= 
y]
: R> seq("a", "d")
: [1] "a" "b" "c" "d"
: R> "a" %:% "d"
: [1] "a" "b" "c" "d"

And just as a follow up to my own post, if you want to make this a bit more
general you might use ascii in place of letters where ascii is defined in:

http://www.r-project.org/nocvs/mail/r-help/2002/0952.html




More information about the R-help mailing list