I am working on a dataset which has multiple species over several plots,
categorised into two treatment groups.

For example

group_xy group_op plot species value
x o 1 A 3
x o 1 A 5
x o 1 B 4
x o 2 A 3
x o 2 A 6
x o 2 A 3
y o 1 A 3
y o 1 A 5
y o 1 B 4
y o 2 A 3
y o 2 A 6
y o 2 A 3
x p 1 A 3
x p 1 A 5
x p 1 B 4
x p 2 A 3
x p 2 A 6
x p 2 A 3
y p 1 A 3
y p 1 A 5
y p 1 B 4
y p 2 A 3
y p 2 A 6
y p 2 A 3

What I would like to do is to take the mean of the species within each plot
in each treatment group, then generate the mean for the species based upon
the average of the values between plots.

Thus the intermediate output would be

group_xy group_op plot species mean_value standard_deviation
x o 1 A 3 sd
x o 1 B 4 sd
x o 2 A 4 sd
y o 1 A 3 sd
y o 1 B 4 sd
y o 2 A 4 sd
x p 1 A 3 sd
x p 1 B 4 sd
x p 2 A 4 sd
y p 1 A 3 sd
y p 1 B 4 sd
y p 2 A 4 sd

Then eventually
group_xy group_op species total_mean_value standard_deviation
x o A 3.5 sd
x o B 4 sd
y o A 3.5 sd
y o B 4 sd
x p A 3.5 sd
x p B 4 sd
y p A 3.5 sd
y p B 4 sd

I am looking for an elegant code which would allow me to do this and
generate plots. for all species for all treatment groups.

Any help would be appreciated!

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to