A shortcut through long loops: An illustration of two alternatives to looping over observations

dc.creatorVanlaar, Ward
dc.date2017-04-01T17:26:46Z
dc.date.accessioned2026-07-09T06:01:14Z
dc.descriptionIt is well known that looping over observations can be slow and should be avoided. The objective of this article is to discuss two alternative solutions to looping over observations that can be used to overcome a particular data-management problem of merging datasets in which unique key identifiers changed over time. The first alternative, mapch, which is introduced in this article, uses a combination of appending, indexing, and merging to solve the problem, while the second alternative uses repeated merging. Both solutions are much quicker than looping over observations. However, depending on the nature of the problem, one solution may work better than the other. It is argued that the use of such dataset-type manipulations may be suitable to overcome other data-management problems. More generally speaking, the issue that is addressed—searching for an alternative to looping over observations—may be common and illustrates the importance of balancing the costs of developing an efficient solution with the benefits accruing from that solution.
dc.identifierOther:dm0041
dc.identifierdoi:10.22004/ag.econ.122620
dc.identifierhttps://ageconsearch.umn.edu/record/122620/files/sjart_dm0041.pdf
dc.identifierhttp://ageconsearch.umn.edu/record/122620
dc.identifier.urihttp://hdl.handle.net/123456789/571321
dc.languageeng
dc.publisher
dc.sourcehttp://ageconsearch.umn.edu/record/122620
dc.titleA shortcut through long loops: An illustration of two alternatives to looping over observations
dc.typeText

Archivos