Funny story... I had (past tense) the habit of hovering my hand over the touchpad... and when I get tired, my finger tends to drop, producing spurious clicks... which did exactly what you're talking about, but with another program. LOL
Ok, first, set up sudoedit:
Then sudoedit your dpkg list of installed applications:
sudoedit /var/lib/dpkg/status
Search through that file for the packages you've accidentally cancelled installation of. Also search for "deinstall" (applications you've removed but not purged).
For each package you find, issue:
sudo apt purge {packagename}
... where {packagename} is the name of the offending package.
So for instance, let's say I've messed up the installation of aptitude:
sudo apt purge aptitude
Do not run that command unless you want to actually uninstall aptitude and purge its files from the hard drive. 'Purge' is 'remove' but it also gets rid of all files associated with the application.
After you've got all the offending packages and all the "deinstall" packages purged, try your installation again.