I’m currently writing some lecture notes on R and I used the phrase “a R package” without thinking. Since the word following the article “a” was a consonant, I automatically went for “a” instead of “an”. The problem is that “R” sounds likes a vowel, so “a R package” grates on the listener. The correctrule is to use “an” when the word following the article “sounds like a vowel”.
A quick google search suggests other people mess up too: