thomas hills <[EMAIL PROTECTED]> writes:
> I am wondering if it is possible to read.table repeatedly from a list
> of file names into a new list of table names.
>
> For example:
>
> filenames <- list.files()
>
> then with a function like
>
> rf <- function(i) {
> word??(filename[i]) <- read.table(filenames[i]) }
>
> I can't seem to find a function like word?? that will be the object of
> another operation. If this worked, then I could repeat it for the
> length of filenames.
>
> Also, even the following function seems to give me an error, but I
> don't yet know why.
>
> rf <- function(nam, i) { nam <- read.table(filenames[i]) }
>
>
> Any help would be very much appreciated.
Something like
listoftables <- lapply(filenames, read.table)
names(listoftables) <- filenames
might be what you are looking for.
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html