jdnewmil at dcn.davis.ca.us
Wed Nov 30 04:32:45 CET 2016
Presumably using read.table instead of read.csv.
Get the import working with one sample file first, then do whatever you
had to do with one file over and over.
You still need to go read up on regex patterns... to get you started the
pattern for matching the csv files would be something like
"Bdat[0-9]*\\.csv$", and the pattern for matching txt files would be
"Bdat[0-9]*\\.txt$", but understanding regular expressions is a topic in
its own right, separate from R. Google is your friend.
On Tue, 29 Nov 2016, Val wrote:
> Thank you Sarah,
> Some of the files are not csv but some are *txt with space delimited.
> How do I do that?
> On Tue, Nov 29, 2016 at 8:28 PM, Sarah Goslee <sarah.goslee at gmail.com> wrote:
>> Something like this:
>> filelist <- list.files(pattern="^test")
>> myfiles <- lapply(filelist, read.csv)
>> myfiles <- do.call(rbind, myfiles)
>> On Tue, Nov 29, 2016 at 9:11 PM, Val <valkremk at gmail.com> wrote:
>>> Hi all,
>>> In one folder I have several files and I want
>>> combine/concatenate(rbind) based on some condition .
>>> Here is the sample of the files in one folder
>>> I want to create 2 files as follows
>>> test_all = rbind(test.csv, test123.csv,test456.csv)
>>> Adat_al l= rbind(Adat.csv, Adat123.csv,Adat456.csv)
>>> The actual number of of files are many and is there an efficient way
>>> of doing it?
>>> Thank you
>> Sarah Goslee
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
More information about the R-help