Pankaj verma
Pankaj verma

Reputation: 1

Capitalize each word in R separated by ;

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; 

Upvotes: 0

Views: 57

Answers (2)

Onyambu
Onyambu

Reputation: 79228

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

Upvotes: 1

amanwebb
amanwebb

Reputation: 380

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) 

Upvotes: 1

Related Questions