To convert a column in R to upper case we use toupper() function. Let’s see how to convert to upper case in R dataframe with an example.
Let’s first create the dataframe.
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 upper case in R dataframe:
toupper() function is used to convert the column to upper case in R from any other case
df1$state_upper = toupper(df1$State) df1
So the upper case converted column along with dataframe will be,