If you want to erase the drive on a Mac before installing Yosemite, or start over at any time, you can use a dedicated installer drive to boot that Mac, erase its drive, and then install the OS clean and restore whatever data you need from a backup.
I recommend making one for Yosemite, on an external hard drive or USB thumb drive, for many of the same reasons I recommend making a bootable Mavericks installer drive: If you want to install Yosemite on multiple Macs, using a bootable installer drive can be more convenient than downloading or copying the entire installer to each computer. Modern, downloadable versions of OS X create a recovery partition on your drive, but it’s always a smart idea to make your own bootable installer drive too. Back in the day when we bought OS X on discs, as long as you kept that disc, you always had a bootable installer just in case.