Home > Blockchain >  Capitalize each word in R separated by ;
Capitalize each word in R separated by ;

Time:08-19

This data I have and I want to capitalize each word.

Cycling Refrigerated Thermal mass Dryer; No-loss Condensate Drain; storage tanks for load/no load screw compressors <50 HP

I want this result.

Cycling Refrigerated Thermal Mass Dryer; No-loss Condensate Drain; Storage Tanks for Load/No Load Screw Compressors <50 HP; 

CodePudding user response:

This should help you out!

library(stringr)

str <- "Cycling Refrigerated Thermal mass Dryer; No-loss Condensate Drain; storage tanks for load/no load screw compressors <50 HP"

str_to_title(str) 

CodePudding user response:

tools::toTitleCase(string)

[1] "Cycling Refrigerated Thermal Mass Dryer; No-Loss Condensate Drain; Storage Tanks for Load/No Load Screw Compressors <50 HP"

Note that the word for has not been capitalized. This replicates exactly what you want

  •  Tags:  
  • r
  • Related