0

I was just trying to convert this upper-cased string to title case using the recommended tools package but couldn't until I used stringr::str_to_title(). This is the exact code I used:

> tools::toTitleCase("TOOL 5a: ASSESSMENT TOOL FOR SOCIAL SUPPORT SERVICES")
[1] "TOOL 5a: ASSESSMENT TOOL for SOCIAL SUPPORT SERVICES"
> stringr::str_to_title("TOOL 5a: ASSESSMENT TOOL FOR SOCIAL SUPPORT SERVICES")
[1] "Tool 5a: Assessment Tool For Social Support Services"

What went wrong with the tools version?

BroVic
  • 979
  • 9
  • 26

1 Answers1

2

Explained in the documentation : ?tools::toTitleCase

No definition of‘title case’ is universally accepted: all agree that ‘principal’ words are capitalized and common words like ‘for’ are not, but not which words fall into each category.

Generally words in all capitals are left alone:

Hence, tools::toTitleCase keeps capital letters as it is.

Community
  • 1
  • 1
Ronak Shah
  • 377,200
  • 20
  • 156
  • 213