[R] List of Dataframes

Jim Holtman jholtman at gmail.com
Tue Apr 22 05:24:51 CEST 2014


also

do.call(rbind, result)

Sent from my iPad

On Apr 21, 2014, at 16:47, "Timothy W. Cook" <tim at mlhim.org> wrote:

> Okay, all day on this and I send the msg. and almost immediately discover
> that:
> 
> dat <- ldply(result)
> 
> solves the problem.
> 
> 
> 
> 
> On Mon, Apr 21, 2014 at 5:40 PM, Timothy W. Cook <tim at mlhim.org> wrote:
> 
>> I am processing an arbitrary number of XML files and extracting specific
>> nodes.  I then create a dataframe for each nodeset.
>> I return a list containing these dataframes.
>> 
>> Example:
>> 
>>> str(result)List of 2
>> $ :'data.frame':    1 obs. of  5 variables:
>>  ..$ data-name       : chr "Etiologic diagnosis of Acute Febrile Hemorrhagic Syndrome"
>>  ..$ valid-time-begin: chr "2014-04-28T01:31:49Z"
>>  ..$ valid-time-end  : chr "3014-04-28T01:31:48Z"
>>  ..$ DvString-dv     : chr "Typhoid fever"
>>  ..$ language        : chr "en-US"
>> $ :'data.frame':    1 obs. of  5 variables:
>>  ..$ data-name       : chr "Etiologic diagnosis of Acute Febrile Hemorrhagic Syndrome"
>>  ..$ valid-time-begin: chr "2014-04-29T01:02:00Z"
>>  ..$ valid-time-end  : chr "3014-04-29T01:01:59Z"
>>  ..$ DvString-dv     : chr "Dengue"
>>  ..$ language        : chr "en-US"
>> 
>> 
>> I would like to have each of the list items as a row in one dataframe.  My
>> attempts so far have been unsuccessful. I have tried t(), merge(),
>> lapply(), etc.  Short of some elaborate *for loop* (I know is frowned
>> upon)  I am out of answers.
>> 
>> I would think this is a fairly common need, maybe even a FAQ that I
>> haven't found yet.
>> 
>> Thanks in advance.
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> --
>> 
>> ============================================
>> Timothy Cook
>> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>> MLHIM http://www.mlhim.org
>> 
>> 
> 
> 
> -- 
> 
> ============================================
> Timothy Cook
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
> MLHIM http://www.mlhim.org
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> 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