I have list of data frames where I am trying to merge all of the elements of the list into a single data frame by applying merge(). I am looking for a general solution that can handle different functions and large numbers of elements of the list.
For a convenient working example, let's use a related problem that should have the same solution. So, assume we have instead a list of numbers:
foo <- list(1, 2, 478, 676)
Let's further assume that I am trying to write a script that takes the first number and divides it by the second. It then takes that quotient and divides it by the third. It then takes that quotient and divides it by the fourth, etc. In the end, I have a single number stored in a single object. For example:
((foo[1] / foo[2]) / foo[3]) / foo[4]
I have seen rapply() for recursive operations on lists, but all of the examples are for delisting lists and not other operations, such as merge() or arithmetic operations.