[R] Iteration through a list in R

Bert Gunter gunter.berton at gene.com
Thu Feb 28 22:41:12 CET 2013


Have you read "An Introduction to R" (ships with R) or other of the
many web tutorials. If not, please do so before posting.

-- Bert

On Thu, Feb 28, 2013 at 4:30 AM, Sahana Srinivasan
<sahanasrinivasan.91 at gmail.com> wrote:
> Hello :)
> I'm just starting out with R and would appreciate your help with a couple
> of problems I am running into.
> I have used Sys.glob to get a list of all filenames having a particular
> file extension (in my case, *.txt)
> I would now like to use this list in the following manner: I would like to
> use each filename from the list and open that file into a tab separated
> matrix and proceed.
> How can I go about iterating through each filename in the list and then
> opening each of the files?
> I believe as.matrix can be used to open the txt file as a table, is that
> correct?
>
> I know these are beginner queries but I would love your help. Thank you in
> advance :)
>
>         [[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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list