In reply to 999thAndy: Yeah, it was a bit trolly.
'If you haven't been hit don't complain.'
The OP didn't say he had to swerve, it just caused distress. Whilst this isn't ideal it is part and parcel of cycling on the road. The more often you're out there the more likely it is to happen to you. This is true of car on car, bike on car, car on ped etc etc. Thinking that the world is all rosey and every driver will give you miles of space is naive and suggests a lack of street smarts.
Ideally you would always give yourself a meter between you and the side of the road, allowing for manoeuvrability in such a situation. I appreciate this isn't always possible but is good practice.
None of what happened gives anyone the right to respond in the way of the OP. It genuinely distresses me that people still respond like this.
'If you get that nervous then get off the road. Stop being a pussy.'
I strongly believe in this. If you get yourself into this sort of situation often, then it's time for a rethink. Responding the way the OP did is disgraceful.
So apologies for the trolly original post. Cycling isn't inherently dangerous and shouldn't be viewed as such. The actions of the few don't reflect the many miles covered without incident. At the same time it isn't anyone's duty other than yourselves to be aware of your surroundings and make things as safe as possible for yourself. If you do this the odds of you getting knocked off are minimal, unfortunately people passing to close for your comfort may still happen but you should, ideally, be prepared for this. If you are responding to the circumstance you put yourself in with violence then you need some help (in the literal, not derogatory sense).