Hi!

An alternative with 'assign':

for ( i in 71:75) {
  setwd(paste("C:/Awork/geneAssociation/removed8samples/neuhausen", i,
sep=""))
  temp.df<-read.csv("seg.pr3.csv", head=T)
  temp.df$id<-paste0("sn",i,sep="")
  assign(paste0("seg",i,sep=""),temp.df)
}
rm(temp.df,i)    # Clean up

HTH,
Kimmo


2018-04-17 kello 08:15 +0200, Albrecht Kauffmann wrote:
> Hello Ding,
> 
> try this:
> 
> seg <- list()
> for ( d in 71:75) {
>   s <- paste0("seg",d)
>   sn <- paste0("sn",d)
>   Dir<-paste("C:/Awork/geneAssociation/removed8samples/neuhausen", i,
> sep="")
>   setwd(Dir)
>   seg[[s]] <- read.csv("seg.pr3.csv", head=T)
>   seg[[s]]$id <- sn
> }
> 
> Greetings,
> Albrecht
>

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to