R&D collaboration and environmental adaptation