While not all dinosaurs lived in groups or herds, there is evidence to suggest that some dinosaurs, like Maiasaura and hadrosaurs, lived in herds for social and protective reasons.
Did all dinosaurs live in groups or herds?