Nikos Alexandris wrote: ... > >>> I have 6 data frames consisting of 6 rows x 7 columns put together from > >>> other data.frames. ... > >>> I want to give the following column names to each data.frame: ("SDev", > >>> "PC1", "PC2", "PC3", "PC4", "PC5", "PC6") ... > >>> How is it to be done at once for all data.frames that the function > >>> objects(pattern = "SomePattern") can find?
Henrique Dallazuanna wrote: > Yes, just in the list. > If they want change the name in Environment GlobalEnv: > > for(i in ls(pattern = "DF[0-9]")) > assign(i, `names<-`(get(i), c("SDev","PC1", "PC2", "PC3", > "PC4", "PC5", "PC6")), globalenv()) It works also using colnames() and rownames(), for example: --%<--- # collect results based on svd svd.results <- objects ( pattern = "^svd.result_of_.*" ) # collect results based on eigenvector(s) eigenvector.results <- objects ( pattern = "^eigenvector.result_of_.*" ) # combine all in one pca.results <- c ( svd.results , eigenvector.results ) # (re-)define column names for ( i in pca.results ) assign ( i , `colnames<-` ( get ( i ) , column_names ) , globalenv ( ) ) # (re-)define row names for ( i in pca.results ) assign ( i , `rownames<-` ( get ( i ) , row_names ) , globalenv ( ) ) --%<--- Henrique D., you are a guRu! Thank you, Nikos ______________________________________________ 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.