DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Iteratively Create Objects

  • submit to reddit
        // Iteratively create objects from a list of names.
// Especially useful for creating consistent model objects for a list of data sources.
// Wrapping the assign statement in a try block is often advisable.

for(item in itemList){
	assign(paste(item, "object", sep="."),  function(get(paste(item, "data", sep=".")), options)
  • r