Subsequence letters using range operation
We can get the subsequence of letters using the index. Index starts with 1 and ends with 26 (since there are 26 letters from a to z). We are getting from letters/LETTERS function.
Syntax:
letters[start:end]
LETTERS[start:end]
Where, start is the starting letter index and end is the ending letter index.
Example: R program to get subsequence letters using index
R
# return all upper case letters from # index 1 to index 12 print ( LETTERS [1:12]) # return all lower case letters from # index 1 to index 12 print ( letters [1:12]) # return all upper case letters from # index 5 to index 26 print ( LETTERS [5:26]) # return all lower case letters from # index 5 to index 26 print ( letters [5:26]) |
Output:
[1] βAβ βBβ βCβ βDβ βEβ βFβ βGβ βHβ βIβ βJβ βKβ βLβ
[1] βaβ βbβ βcβ βdβ βeβ βfβ βgβ βhβ βiβ βjβ βkβ βlβ
[1] βEβ βFβ βGβ βHβ βIβ βJβ βKβ βLβ βMβ βNβ βOβ βPβ βQβ βRβ βSβ βTβ βUβ βVβ βWβ βXβ βYβ βZβ
[1] βeβ βfβ βgβ βhβ βiβ βjβ βkβ βlβ βmβ βnβ βoβ βpβ βqβ βrβ βsβ βtβ βuβ βvβ βwβ βxβ βyβ βzβ
Sequence of Alphabetical Character Letters from A-Z in R
In this article, we are going to discuss how to get a sequence of character letters from A-Z in R programming language.
Contact Us