Description Usage Arguments Value Author(s) Examples
A function to change words to their singular form. The rules for converting words to their singular forms are based on the inverse of the grammar rules found here: https://www.grammarly.com/blog/plural-nouns/. This function handles most special cases and some irregular cases (see examples) but caution is necessary. If no singular form is identified, then the original word is returned.
1 | singularize(word, dictionary = TRUE)
|
word |
Character. A word |
dictionary |
Boolean.
Should dictionary be used to verify word exists?
Default to |
Returns the word in singular form, unless a singular form could not be found (then the original word is returned)
Alexander Christensen <alexpaulchristensen@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # Handles any prototypical cases
# "dog"
singularize("dogs")
# "fox"
singularize("foxes")
# "wolf"
singularize("wolves")
# "octopus"
singularize("octopi")
# "taxon"
singularize("taxa")
# And most special cases:
# "wife"
singularize("wives")
# "fez"
singularize("fezzes")
# "roof"
singularize("roofs")
# "photo"
singularize("photos")
# And some irregular cases:
# "child"
singularize("children")
# "tooth"
singularize("teeth")
# "mouse"
singularize("mice")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.