[R] assign() won't work

Uwe Ligges ligges at statistik.uni-dortmund.de
Sun May 25 11:28:06 CEST 2003



"Brian J. Lopes" wrote:
> 
> Hey everyone, I've been searching the mail lists, and I can't find a real discussion about my problem.  Here it is:
> 
> I have created a loop fitting various time series models to my data.  I labeled each one of the outputs by using the assign and paste statements, i.e. assign(paste("group","subgroup",i),arima(...)).  Works great, but here's what I need...
> 
> I want to create a tables by group, and refer to particular information from each arima fit, such as AIC value, loglikelihood value, etc.
> 
> My best guess is,
> assign(paste("group","subgroup"),get(paste("group",subgroup",i))$aic
> 
> This won't work, due to the restrictions of my the assign function.  If you can't understand this from the code, here it is verbally:
> 
> I've got a bunch of matrices to fill-in with information, all their names are part of this paste function (59 in total).  I want to fill in the rows of each matrix with the information from every analysis provided for each group.  (i.e. for ARMA(1,0) I want a row of the aic and loglikelihood values, but I want this for the ARMA(1,1) model I ran, and the ARMA(2,0) model I ran as well)  I have done many ARMA's for many different series, and want to make a table for each series.  There are too many of these to do this for each individual series.
> 
> Thanks for your help!
> Pura Vida,
> Brian

1) Please, tell your mailtool to wrap lines (and not to send in HTML
format which has been deleted anyway).

2) I don't get the point completely.

3) I guess you are going to use a list (of matrices or other appropriate
data structures) instead a huge number of single objects (in your case
matrices). Access to list elements should be much easier to handle.

Uwe Ligges




More information about the R-help mailing list