Hello, I have a dataframe (obtained from read.table()) which looks like
ExpA ExpB ExpC Size 1 12 23 33 1 2 12 24 29 1 3 10 22 34 1 4 25 50 60 2 5 24 53 62 2 6 21 49 61 2 now I want to take all rows that have the same value in the "Size" column and apply a function to the columns of these rows (for example median()). The result should be a new dataframe with the medians of the groups, like this: ExpA ExpB ExpC Size 1 12 23 34 1 2 24 50 61 2 I tried to play with the functions by() and tapply() but I didn't get the results I wanted so far, so any help on this would be great! The reason why I am having this problem: (I explain this just to make sure I don't do something against the nature of R.) I am doing 3 simillar experiments, A,B,C and I change a parameter in the experiment (size). Every experiment is done multiple times and I need the median or average over all experiments that are the same. Should I preprocess my data files so that they are completely different? Or is it fine the way it is and I just overlooked the simple solution to the problem described above? Regards, Timo ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.