is there an easy/straightforward way to merge dataframes from a list that have a common column? I tried sapply but didn't quite know how to index properly.
So for example, my list looks like this:
rms.byhr
$band1
Group.1 x
1 0 105.0167
2 1 104.8673
3 2 104.7015
4 3 104.6000
5 4 104.9439
6 5 105.0677
7 6 104.6434
8 7 104.2099
9 8 103.7765
10 9 103.3561
$band2
Group.1 x
1 0 94.48735
2 1 94.25948
3 2 94.18401
4 3 94.09341
5 4 94.33667
6 5 94.85422
7 6 94.59766
8 7 94.32328
9 8 93.93813
10 9 93.78168
I tried
rms.byhr<-as.data.frame(sapply(rms.byhr, function(x){merge(rms.byhr$x, by=rms.byhr$Group.1)})
But I can see why this doesn't work. Is there a way to index the prior or next element in a list using sapply?
I could just write a loop, but this seems more complicated. Also, I'd like it to be able to "work" even if I only have one DF in my list (or would give merge an error no matter what and I would need to make a conditional?)