Kondamani, Arjun (GMI - NY Corporate Bonds)
2007-Dec-26 21:23 UTC
[R] Rbind-ing a list into one item
Hi, I am doing the following: 1. I have a list of files.. Files1=list.files("some directory",pattern="some pattern") 2. I define a list as res=vector("list", length(files1)) 3. I read all the files into this list: res=lapply(files1, read.csv) I now want to rowbind all the items in the list into one big mass (all files have same number of columns). I tried lapply(res, rbind) but that did not work. Suggestions? -------------------------------------------------------- This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing. -------------------------------------------------------- [[alternative HTML version deleted]]
>From: "Kondamani, Arjun (GMI - NY Corporate Bonds)" <arjun_kondamani at ml.com> >Date: 2007/12/26 Wed PM 03:23:51 CST >To: r-help at r-project.org >Subject: [R] Rbind-ing a list into one itemtry do.call(rbind,res)>Hi, > >I am doing the following: > >1. I have a list of files.. Files1=list.files("some >directory",pattern="some pattern") >2. I define a list as res=vector("list", length(files1)) >3. I read all the files into this list: res=lapply(files1, read.csv) > >I now want to rowbind all the items in the list into one big mass (all >files have same number of columns). I tried lapply(res, rbind) but that >did not work. Suggestions? >-------------------------------------------------------- > >This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing. >-------------------------------------------------------- > > [[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.
Hi Arjun, try do.call() Cheers Andrew On Wed, Dec 26, 2007 at 04:23:51PM -0500, Kondamani, Arjun (GMI - NY Corporate Bonds) wrote:> Hi, > > I am doing the following: > > 1. I have a list of files.. Files1=list.files("some > directory",pattern="some pattern") > 2. I define a list as res=vector("list", length(files1)) > 3. I read all the files into this list: res=lapply(files1, read.csv) > > I now want to rowbind all the items in the list into one big mass (all > files have same number of columns). I tried lapply(res, rbind) but that > did not work. Suggestions? > -------------------------------------------------------- > > This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing. > -------------------------------------------------------- > > [[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. > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean.-- Andrew Robinson Department of Mathematics and Statistics Tel: +61-3-8344-9763 University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599 http://www.ms.unimelb.edu.au/~andrewpr http://blogs.mbs.edu/fishing-in-the-bay/