[R] [solved] scripting/littler: How to call function named iteratively (`f1`, `f2`, …)?

Paul Menzel paulepanter at users.sourceforge.net
Fri Jul 29 16:08:26 CEST 2011


Dear Eik,


Am Freitag, den 29.07.2011, 15:46 +0200 schrieb Eik Vettorazzi:
> how about this
> for (i in 1:2) { print( do.call(paste("f",i,sep=""),list(2, 3) )) }
> 
> or using get
> for (i in 1:2) { print( get(paste("f",i,sep=""))(2, 3) ) }

works great for me. Thank you very much. Regarding search machines it is
sad that the names of these commands are so general – which is of course
a good thing when knowing them and using them.


Thanks,

Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110729/ed61ce7b/attachment.bin>


More information about the R-help mailing list