Message-ID: <41A47748.6060206@statistik.uni-dortmund.de>
Date: 2004-11-24T11:58:00Z
From: Uwe Ligges
Subject: Automatic file reading
In-Reply-To: <41A46C1A.2030105@maths.lth.se>
Anders Malmberg wrote:
> Hi,
>
> I want to do automatic reading of a number of tables (files) stored in
> ascii format
> without having to specify the variable name in R each time. Below is an
> example
> of how I would like to use it (I assume files pair1,...,pair8 exist in
> spec. dire.)
>
> for (i in 1:8){
> name <- paste("pair",i,sep="")
> ? ? ? <- read.table(paste("/home/andersm/tmp/",name,sep=""))
> }
pairlist <- vector(8, mode = "list")
for (i in 1:8){
name <- paste("pair",i,sep="")
pairlist[[i]] <- read.table(paste("/home/andersm/tmp/",name,sep=""))
}
or use assign(), but you don't want to do that really.
Uwe Ligges
> after which I want to have pair1,...,pair8 as tables.
>
> But I can not get it right. Anybody having a smart solution?
>
> Best regards,
> Anders Malmberg
>
> ______________________________________________
> 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