[R] Naming output file

Ivan Krylov |kry|ov @end|ng |rom d|@root@org
Mon Jun 24 15:00:49 CEST 2024


В Mon, 24 Jun 2024 20:16:46 +0800
Steven Yen <styen using ntu.edu.tw> пишет:

> In the call to ame.bopa in a loop, I like inputs in the call to 
> ame.bopa to be bop1, bop2, bop3,... Thanks.
> 
> for (im in 1:m) {
> ame<-ame.bopa(bop,y1.level=y1value,y2.level=y2value,jindex=jindex1,vb.method="invH",joint12=TRUE,
>                  printing=FALSE,testing=TRUE)
> }

Use get(paste0('bop', im)) to read a variable named paste0('bop', im).

If you used a list like suggested by Rui, you would be able to use the
same syntax for read and write access, namely, bop[[im]], instead of
manually assigning variables using assign(name, value) and manually
reading variables using get(name).

-- 
Best regards,
Ivan



More information about the R-help mailing list