On Fri, Feb 24, 2012 at 3:47 PM, Adel ESSAFI <adeless...@gmail.com> wrote: > Hello, > I want to create 10 dataframe using a for loop. > I don t know what to do to create 10 different dataframes whose name is > parametrized with variable i. > This syntaxe fails. It create a unique fataframe called dfn. > Any input will help > Thanks > >> for (i in 1:10){ > + filename=paste("avail4",i,sep = "_") > + dfn=read.table(filename) > + }
You may want to create a list of 10 data frames. dfn = list(); for (i in 1:10){ filename=paste("avail4",i,sep = "_") dfn[[i]]=read.table(filename) } This way dfn[[1]] will be the data frame read from the first file, dfn[[2]] from the second file etc. Hope this helps, Peter ______________________________________________ R-help@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.