[R] A vector or array of data frames
Dimitris Rizopoulos
dimitris.rizopoulos at med.kuleuven.ac.be
Thu Feb 17 14:26:40 CET 2005
you could use something like:
file. <- c:/data/dat # the path for the data
lis.dat <- lapply(1:B, function(i) read.table(paste(file., i,
sep="")) )
where B is the number of files whose names are: dat1, dat2, ..., datB.
Then lis.dat[[1]] will be the first data.frame.
I hope it helps.
Best,
Dimitris
----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
----- Original Message -----
From: "michael watson (IAH-C)" <michael.watson at bbsrc.ac.uk>
To: <r-help at stat.math.ethz.ch>
Sent: Thursday, February 17, 2005 2:01 PM
Subject: [R] A vector or array of data frames
> Hi
>
> A simple question again, but I can't find it by google-ing R-help.
>
> Quite simply, I want to read in the contents of a number of files,
> using
> read.table, and assign the results to elements of a
> vector/array/list/whatever.
>
> I want it so that, if my vector/array/whatever is "pos", that pos[1]
> will give me the first data frame, pos[2] will give me the second
> etc...
>
> Kind of basic stuff I know... Sorry..
>
> Mick
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
More information about the R-help
mailing list