Names, like other words, are sometimes subject to change over time. In one case, the Latin 'Ricardus' became the Anglo-Norman 'Ricard'. That, in turn, was shortened to 'Ric(k)' and then was playfully altered to the rhyming form beginning with the letter 'D'. The Latin �Guglielmus', the French 'Guillaume' and the Germanic �Wilhelm' gradually became 'Bill' in much the same manner...being shortened initially to �Will'.
We find the same process with the female name �Margaret'. It was abbreviated to �Maggie' then �Meggie' before becoming �Peggy'
All these names involve an initial abbreviation followed by some playful alteration of the first letter. Dolores - Lola, Agnes - Nancy and Robert - Bob are similar.