Skip to contents

Appends an "n" to the indefinite article "a" if required by English language rules.

Usage

n_ify(x)

Arguments

x

A character vector.

Value

A character vector.

Details

Note that this function only covers part of all cases where "an" instead of "a" is indicated. Since the choice of a or an depends on sound, not spelling, it's not trivial to implement a universal solution.

For example, this function doesn't properly append an "n" to the indefinite article in the following situations:

  • A word starting with the letter "u" where it is pronounced as a vowel, e.g. unhappy. Note that most English words starting with letter "u" are pronounced differently like universum and thus require the indefinite article a, not an.

  • A word starting with a consonant that is pronounced as a vowel, e.g. hour.

Examples

n_ify("This is a absolute disaster, such a error.")
#> [1] "This is an absolute disaster, such an error."