I have a dataset like this:

```
set.seed(10)
df <- data.frame(
Year = rep(2000, times=16),
Month = rep(1:2, each=8),
group = rep(c("ABC","ABc","Abc","AbC","aBC","aBc","abc", "abC"),times=2),
A_gr = rep(c("A","A","A","A","a","a","a","a"), times=2),
V = rnorm(16)
)

```

Where A, B and C can have either the form of a capital or a small letter.
For each point in time (month + year) and group combination I now want to subtract the V-value of the capital letter version from the small letter version. So aBC-ABC, aBc-ABc etc.

With only 2 group letters I managed to do that with order, list and by but I cannot make that work here. I also experimented with plyr but did not succeed neither. Any ideas?

Further I wonder if it is possible to subtract the sum of all four capital letter versions from the sum of the small letter versions in one step, so (aBC+aBc+abc+abC)-(ABC+ABc+Abc+AbC)