An analysis of a large dataset on immigrant integration in Spain. The statistical mechanics perspective on social action