Re: [R] Append/merge

About this list Date view Thread view Subject view Author view Attachment view

From: Mark Myatt (mark@myatt.demon.co.uk)
Date: Fri 20 Jul 2001 - 21:47:10 EST


Message-id: <C984XBA+oBW7Ew2X@myatt.demon.co.uk>

Debra Taylor <debrat@bestweb.net> writes:
> I have a question about stacking datasets.
>
> I have 40 stata datasets that have exactly the same number of
> variables, with the same names (~420k rows, 8 columns).
>
> The datasets are relatively large ~ 15 megs.
>
> If they were text files a linux "cat file1 file2 >> combo" sort of
> strategy would work.

[Snip]

> Does somebody have an R solution in mind?

Read each data file in as a data frame then use the rbind() function.
Something like:

        a <- read.table("file1", header = T)
        b <- read.table("file2", header = T)
        my.data <- rbind(a, b)
        #
        # remove the excess 15MB ...
        #
        rm(b)
        a <- read.table("file3", header = T)
        my.data <- rbind(ab, a)
        #
        # and so on ... finally removing the excess 15MB ...
        #
        rm(a)

Mark

--
Mark Myatt

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Wed 10 Mar 2004 - 08:18:20 EST