[Solved] How to find average of a col1 grouping by col2 [duplicate]
With a data.frame named dat that looked like: rank name country category sales profits assets marketvalue 21 21 DaimlerChrysler Germany Consumer_dur 157.13 5.12 195.58 47.43 Try (untested d/t the numerous spaces in the text preventing read.table from making sense of it): aggregate(dat[ , c(“sales”, “profits”, “assets”, “marketvalue”)], # cols to aggregate dat[“country”], # group column … Read more