Assigning many I2C addresses to an Arduino

After some research I've got an idea to make the arduino simulate different sensors but I'm not sure.
Is it possible in the setup function of the slave (which will be the writer) to insert an "if" condition to the wire.begin(address) and so I give a different address to my arduino. For example :

void setup()
{
if (condition) wire.begin(2);
else wire.begin(4);
Wire.onRequest(requestEvent);
}

The problem for now is that the setup fonction is called once, so can I call it periodically?
And does it make sense ?