Hi Mario!
I'm not really familiar with this kind of manipulations, but I think you
can do it more or less like this (some people on this list might give a
more detailed answer):
#Create an empty named list
list_df <- vector(mode="list", length=length(lista_rec_c))
names(list_df) <- lista_rea_c ##or some part of it using gsub or
something similar
#Import
for (i in lista_rea_c) {
list_df[[i]] <- read.xlsx(...)
}
#rbind
do.call(rbind, list_df)
This probably won't work like this exactly but you should be able to
make the modifications.
HTH,
Ivan
--
Ivan CALANDRA
Universit? de Bourgogne
UMR CNRS/uB 6282 Biog?osciences
6 Boulevard Gabriel
21000 Dijon, FRANCE
+33(0)3.80.39.63.06
ivan.calandra at u-bourgogne.fr
http://biogeosciences.u-bourgogne.fr/calandra
Le 12/03/13 15:52, A M Lavezzi a ?crit :> Hello everybody
>
> I have the following problem. I have to load a number of xls files from
> different folders (each xls file has the same number of columns, and
> different numbers of rows). Each xls file is named with a number, i.e.
> 12345.xls and is contained in a folder with same name, say 12345)
>
> Once loaded, I want to rbind all of them to obtain a single database.
>
> I think I successfully did the first part, using "assign":
>
> for (i in lista_rea_c){
>
> name=paste("reaNum",i,sep="",collapse=NULL)
>
>
assign(name,read.xlsx(file=paste(path,i,"/",i,".xls",sep="",collapse=NULL),1,header=TRUE,as.data.frame=TRUE))
>
> }
>
> where lista_rea_c contains the "numbers" and is obtained
> as: lista_rea_c = list.files(path = "/Users/mario/Dropbox/..., and
path is
> defined elsewhere
> At this point I have a number of variables, names as
"reaNum12345" ecc.
>
> I would like to rbind all of them, but what I get is that I rbind
> "reaNum12345", i.e. the variable name and not the data it
contains.
>
> Can anyone help?
>
> thanks!
> Mario
>
>
>
>
> ______________________________________________
> R-help at 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.