R: How to get the index of a letter from a list A-Z?
Posted
by John
on Stack Overflow
See other posts from Stack Overflow
or by John
Published on 2010-03-16T20:28:05Z
Indexed on
2010/03/16
20:31 UTC
Read the original article
Hit count: 222
I want to get the index of a particular letter, e.g.
> match(LETTERS,"G")
[1] NA NA NA NA NA NA 1 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Gives me that the letter exists, but I want it to return 6 in this case for the 6th element of the list.
© Stack Overflow or respective owner