Re: [R] Programmatically give file name to a matrix

2013-01-30 Thread Kumar Mainali
Thank you Pascal and Greg for the suggestion. That is exactly what I needed! - Kumar On Wed, Jan 30, 2013 at 2:14 AM, Pascal Oettli wrote: > Hello, > > ?assign > > assign(paste("plotroc_GBM_Trn_**", i, sep=""), matrix(rnorm(100),10,10)) > > HTH, > Pascal > > > Le 30/01/2013 17:04, Kumar Mainali

Re: [R] Programmatically give file name to a matrix

2013-01-30 Thread Greg Snow
This is FAQ 7.21. The most important part of that answer is at the end where it says that it is better to use a list. Your code could be something like: plotroc <- list() for (i in levels(mergeTrn$Continent) { # matrix defined here plotroc[[ paste("plotroc_GBM_TRN_",i, sep="") ]] <- matrix }

Re: [R] Programmatically give file name to a matrix

2013-01-30 Thread Pascal Oettli
Hello, ?assign assign(paste("plotroc_GBM_Trn_", i, sep=""), matrix(rnorm(100),10,10)) HTH, Pascal Le 30/01/2013 17:04, Kumar Mainali a écrit : I have a situation when I need to save matrix with file names that are programmatically created. for (i in levels(mergeTrn$Continent)) { ma

[R] Programmatically give file name to a matrix

2013-01-30 Thread Kumar Mainali
I have a situation when I need to save matrix with file names that are programmatically created. for (i in levels(mergeTrn$Continent)) { matrix here # I want to save this matrix with a file name that carries "i" from for loop. The following does not work. paste("plotroc_GBM_Trn_", i,