How long can you leave filament in the extruder
Most filaments you can leave in the extruder indefinitely without any ill effects.

There are some filaments that need to be stored away from moisture, particularly Nylon, because they absorb moisture from the air and don't print well if they contain a lot of absorbed moisture. However, this isn't an inherent issue with having the filaments in the extruder (if you had some setup that protected the filament from moisture while in the extruder, that would be fine as well - but in most cases it is more practical to store such filament in an airtight box). 

Most commodity filaments (ABS/PLA/PETG) don't suffer from this as much (PLA supposedly also absorbs moisture but I haven't noticed this to be a problem, perhaps it depends on the conditions of the room in which your printer is kept) so they're fine to leave in the extruder.