- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a data frame column with letters of both size in R?
To create a data frame column with letters of both sizes, we can simply use the letters function and LETTERS function, the first one corresponds to lowercase letters and the latter corresponds to uppercase letters with single square brackets as shown in the below examples.
Example1
df1<-data.frame(UPPER=LETTERS[1:26]) df1
Output
UPPER 1 A 2 B 3 C 4 D 5 E 6 F 7 G 8 H 9 I 10 J 11 K 12 L 13 M 14 N 15 O 16 P 17 Q 18 R 19 S 20 T 21 U 22 V 23 W 24 X 25 Y 26 Z
Example2
df2<-data.frame(lower=letters[1:26]) df2
Output
lower 1 a 2 b 3 c 4 d 5 e 6 f 7 g 8 h 9 i 10 j 11 k 12 l 13 m 14 n 15 o 16 p 17 q 18 r 19 s 20 t 21 u 22 v 23 w 24 x 25 y 26 z
- Related Articles
- How to create a column with largest size string value in rows in an R data frame?
- How to create a boxplot of single column in R data frame with column name?
- How to create a column in an R data frame with cumulative sum?
- How to create a blank column with randomization in an R data frame?
- How to create a data frame with a column having repeated values in R?
- How to create a group column in an R data frame?
- How to create a lagged column in an R data frame?
- How to create a duplicate column in an R data frame with different name?
- How to match a column in a data frame with a column in another data frame in R?
- How to create a column with the serial number of values in character column of an R data frame?
- How to create a new column with a subset of row sums in an R data frame?
- How to create a replacement column with multiple conditions and NA in R data frame?
- How to create a column with column name for maximum value in each row of an R data frame?
- How to create a categorical variable using a data frame column in R?
- How to create a data frame with combinations of values in R?

Advertisements