As of 1.4, NPCs are affected by happiness ratings. In order to fulfill this happiness, you need to have specific NPCs in specific locations. Currently, you can designate a house for an NPC, but you can't actively overwrite it. So in order to swap two NPCs you have to build an empty house...