Skip to content

Instantly share code, notes, and snippets.

@pH-7
Last active July 18, 2025 13:43
Show Gist options
  • Save pH-7/38e042af2cae518184a1975c2b55e697 to your computer and use it in GitHub Desktop.
Save pH-7/38e042af2cae518184a1975c2b55e697 to your computer and use it in GitHub Desktop.
R helper functions for strings
##
# Convert text to lowercase.
##
to_lowercase <- function(input_text) {
# Check if input is character
if (!is.character(input_text)) {
stop("Input must be a character string")
}
# Convert to lowercase
tolower(input_text)
}
# Usage
example_text <- "This is my Sleep Routine Hack: How to Get More Done Without Working Harder"
print(to_lowercase(example_text))
@pH-7
Copy link
Author

pH-7 commented Jul 18, 2025

# Example
text <- "This is my Sleep Routine Hack: How to Get More Done Without Working Harder"
print(to_lowercase(text))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment