Can we have better semantics for attach()? ----------------------------------------- The semantics of attached data frames have baffled many R beginners, to the extent that some people recommend that these mechanisms should simply not be taught. However, they do offer notational simplification, and it might be argued that, at least to some extent, the problem is that things do not behave like users would reasonably expect. In particular, there appears to be no "nice" way of modifying a data frame persistently. With some care, you can modify the attached data frame instead of the global environment, but since this is a copy, it has no effect on the original data. Conversely, modifying the original data after attaching has no effect without a detach/attach operation. It doesn't even help to use with() constructs since this also involves an implicit copy. The transform() function has its own shortcomings which are about to convince its author that it was always the wrong solution. Then again, there are good reasons for the current situation. One important aspect is that R's scoping semantics only deal with environments, and that there is a mapping from data frames to environments, but not the other way around. Thus there are no easy solutions, but there might be room for some more elaborate constructions. The purpose of the talk is to explore the potential for and ramifications of modifying the attach() system.