To convert a column in R to lower case we use tolower() function. Let’s see how to convert to lower case in R with an example.
Let’s first create the dataframe.
1 2 3 | df1 = data.frame (State = c ( 'Arizona AZ' , 'Georgia GG' , 'Newyork NY' , 'Indiana IN' , 'Florida FL' ), Score= c (62,47,55,74,31)) df1 |
so the dataframe will be
Convert to lower case in R dataframe:
tolower() function is used to convert the column to lower case in R from any case.
1 2 | df1$state_lower = tolower (df1$State) df1 |
So the lower case converted column along with dataframe will be,