Dear list, I would generate a loop: a<-c(1:98) for (i in a ) { cbind(vor.tile[[i]]$x, vor.tile[[i]]$y)->p rbind(p,c(p[1,]))->p.c Polygon(p.c)->pc.p Polygons(list(pc.p),sprintf("p%s",i))->pc.ps sprintf("pc.ps%s",i)<-pc.ps } I need to obtain 98 pc.ps objects (like: pc.ps1, pc.ps2....pc.ps98) but I d'ont use sprintf for it. How can made it? many tanks in advance -- View this message in context: http://n4.nabble.com/naming-consecutive-objects-tp1694985p1694985.html Sent from the R help mailing list archive at Nabble.com.
Hi It is really a nice example. You managed to break probably all rules specified in posting guide No reproducible example No structure of data No explain what you really want No effort on your side even to look to docs. You maybe want some object of type list. obj <- vector(98, mode="list" you can call components of this object by obj[[i]] and assign values to it by obj[[i]] <- whatever Regards Petr r-help-bounces at r-project.org napsal dne 29.03.2010 13:14:54:> > Dear list, > > I would generate a loop: > > > a<-c(1:98) > for (i in a ) > { > cbind(vor.tile[[i]]$x, vor.tile[[i]]$y)->p > rbind(p,c(p[1,]))->p.c > Polygon(p.c)->pc.p > Polygons(list(pc.p),sprintf("p%s",i))->pc.ps > > sprintf("pc.ps%s",i)<-pc.ps > } > > I need to obtain 98 pc.ps objects (like: pc.ps1, pc.ps2....pc.ps98) butI> d'ont use sprintf for it. > > How can made it? > > many tanks in advance > > -- > View this message in context:http://n4.nabble.com/naming-consecutive-objects-> tp1694985p1694985.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.
Hi, what about: assign()? I don't know if it's really important, but I've always seen the assignment operator the other way (<-) HTH, Ivan Le 3/29/2010 13:14, dgallego a ?crit :> Dear list, > > I would generate a loop: > > > a<-c(1:98) > for (i in a ) > { > cbind(vor.tile[[i]]$x, vor.tile[[i]]$y)->p > rbind(p,c(p[1,]))->p.c > Polygon(p.c)->pc.p > Polygons(list(pc.p),sprintf("p%s",i))->pc.ps > > sprintf("pc.ps%s",i)<-pc.ps > } > > I need to obtain 98 pc.ps objects (like: pc.ps1, pc.ps2....pc.ps98) but I > d'ont use sprintf for it. > > How can made it? > > many tanks in advance > >-- Ivan CALANDRA PhD Student University of Hamburg Biozentrum Grindel und Zoologisches Museum Abt. S?ugetiere Martin-Luther-King-Platz 3 D-20146 Hamburg, GERMANY +49(0)40 42838 6231 ivan.calandra at uni-hamburg.de ********** http://www.for771.uni-bonn.de http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php