[R] Object oriented programming in R.
Rainer M Krug
r.m.krug at gmail.com
Tue Sep 14 13:58:01 CEST 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 14/09/10 13:51, Liviu Andronic wrote:
> On Tue, Sep 14, 2010 at 12:55 PM, Alaios <alaios at yahoo.com> wrote:
>> Thank you very much. I checked the tutorials that on that list but still I do
>> not know how to create many objects of the same type. Can you please help me
>> with that?
>>
> Is this what you need?
> for(i in 1:100){
> assign(paste('tmp', i, sep=''), NULL)
> }
> ls()
>
> Liviu
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
look at ?rep:
x <- rep(list(createTheObject(), 10)
x will be a list containing 10 times the object created by createTheObject()
Cheers,
Rainer
- --
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)
Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa
Tel: +33 - (0)9 53 10 27 44
Cell: +27 - (0)8 39 47 90 42
Fax (SA): +27 - (0)8 65 16 27 82
Fax (D) : +49 - (0)3 21 21 25 22 44
Fax (FR): +33 - (0)9 58 10 27 44
email: Rainer at krugs.de
Skype: RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkyPY0kACgkQoYgNqgF2egr5hQCePJ+20z2d64SPVOtIFxv7dmBs
ASwAnAhQbm4snJFqYj1dOn2w6NSRLIC+
=wuQC
-----END PGP SIGNATURE-----
More information about the R-help
mailing list