[R] merge_recurse in libray reshape - how does it work?

Stephen Sefick ssefick at gmail.com
Fri May 31 16:10:55 CEST 2013


Thanks for the help.  I think I have it figured out...

inside of merge dfs[-1] lops off the first element in the list and 
merges with dfs[[1]] then this is repeated for the entire list? With 
Recall inside of a function this process repeats until there are no more 
objects to merge?

many thanks,

Stephen

On 05/30/2013 10:02 PM, Dennis Murphy wrote:
> For the general purpose of Recall, this might help:
>
> http://rfunction.com/archives/364
>
> It's typically used in recursive function definitions - e.g., the
> Fibonacci series.
>
> Dennis
>
> On Thu, May 30, 2013 at 7:57 PM, Stephen Sefick <sas0025 at auburn.edu> wrote:
>> merge_recurse
>> function (dfs, ...)
>> {
>>      if (length(dfs) == 2) {
>>          merge(dfs[[1]], dfs[[2]], all = TRUE, sort = FALSE, ...)
>>      }
>>      else {
>>          merge(dfs[[1]], Recall(dfs[-1]), all = TRUE, sort = FALSE,
>>              ...)
>>      }
>> }
>>
>> I do not understand how the Recall part of this function works.  Could
>> somebody explain this to me?
>> many thanks,
>>
>>
>> --
>> Stephen Sefick
>> **************************************************
>> Auburn University
>> Biological Sciences
>> 331 Funchess Hall
>> Auburn, Alabama
>> 36849
>> **************************************************
>> sas0025 at auburn.edu
>> http://www.auburn.edu/~sas0025
>> **************************************************
>>
>> Let's not spend our time and resources thinking about things that are so
>> little or so large that all they really do for us is puff us up and make us
>> feel like gods.  We are mammals, and have not exhausted the annoying little
>> problems of being mammals.
>>
>>                                  -K. Mullis
>>
>> "A big computer, a complex algorithm and a long time does not equal
>> science."
>>
>>                                -Robert Gentleman
>>
>> ______________________________________________
>> R-help at 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.



More information about the R-help mailing list