[R] Programmatically give file name to a matrix

Pascal Oettli kridox at ymail.com
Wed Jan 30 09:14:32 CET 2013


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)) {
>          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, sep="") <- matrix
>
> }
>
> Thanks,
> Kumar
>



More information about the R-help mailing list