-1

I have a dataframe with multiple columns out of which one column has city names with first letter in uppercase. I want to see the all city names in this particular with lowercase letters and an updated data frame with all the existing columns.

Ex-

colA,colB,colC
Australia,Albany,23
Australia,Sydney,56
India,Delhi,67
India,Guntur,89

I want output as

colA,colB,colC
Australia,albany,23
Australia,sydney,56
India,delhi,67
India,guntur,89

I tried using 'dplyr::mutate_each' function but ended up like following

colB
albany   
sydney   
delhi    
guntur 
Frank
  • 65,012
  • 8
  • 95
  • 173
vamC
  • 3
  • 1
  • 4
  • Just change the `toupper` to `tolower` in the link above – Sotos Mar 21 '17 at 15:25
  • @Sotos, @Japp; Apologies if I didn't convyed my question properly. Ms Jess has suggested the right code for which I got the exact result I am looking for. – vamC Mar 23 '17 at 15:49

2 Answers2

4

The tolower function should do the trick like so:

df <- df %>% 
      mutate(colB = tolower(colB)
jess
  • 514
  • 2
  • 7
2

dataframe$column<-sapply(dataframe$column, tolower)

Clarius
  • 918
  • 8
  • 7