[R] Need help: R for repetitive tasks

R. Michael Weylandt michael.weylandt at gmail.com
Tue Jan 15 14:32:07 CET 2013


list.files() to get all the files in the directory (use the pattern
argument to be more specific). Then loop over the file names, reading
in the data one at a time, do the desired processing, and then use the
file name to make the graphics file name as well.

Cheers, MW

On Tue, Jan 15, 2013 at 12:30 PM, Simonas Kecorius
<simolas2008 at gmail.com> wrote:
> Dear R users,
>
> First of all I would like to thank all of you who replayed to my previous
> questions and problems. Thank you a lot for being great and helpful
> community. I highly appreciate your suggestions and ideas even if I do not
> respond after my question! But it means that your help was exactly what I
> needed. Thank you again!
>
> Now the following question I need help:
>
> Suppose I do have a file.txt in the working directory. This file contains
> the names of other files in the same directory:
>
> First.txt
> Second.txt
> Third.txt
> etc...
>
> Files First.txt, Second.txt...are data files.
>
> What I need R to do, is to read this file.txt line by line, open files
> which names are listed ( First.txt, Second.txt...) and process it: lets say
> make a FirstPlot.bmp, FirstSummary.txt  and save it to working directory,
> then automatically open Second.txt, do the same, Third.txt etc. until the
> end of the names in file.txt.
>
> This would help me with the following task: I do measurements each day, and
> I need to process my data: draw some plots, make some analysis.  When I
> have 30 days of measurements each 1 second, there are huge amount of
> numbers I am dealing with. If you could suggest some automation via R, it
> would be perfect.
>
> Thank you in advance.
>
> Cheers.
>
> --
> Simonas Kecorius
> **Lithuania
>
>         [[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