Consider the following example.
renamer <- function(df, b, a) { colnames(df)[colnames(df) == b] <- a; df }
iris2 <- munge(iris, list(Renamer = list(renamer, "Sepal.Length", "seplen"), "Renamer2" = list(renamer, "Sepal.Width", "sepwid")))
length(attr(iris2, "mungepieces")) # 2
iris3 <- munge(iris2, iris2)
length(attr(iris3, "mungepieces")) # 4
Since mungepieces are "sticky": munging iris2 against itself means that the initial munging history is remembered followed by another copy of the munging history. Is that really the right behavior, or should each operation of munge destroy the copy of the mungepieces? The answer is presumably no to support chaining of munge operations, but the results here are counter-intuitive.
Consider the following example.
Since mungepieces are "sticky": munging iris2 against itself means that the initial munging history is remembered followed by another copy of the munging history. Is that really the right behavior, or should each operation of
mungedestroy the copy of the mungepieces? The answer is presumably no to support chaining of munge operations, but the results here are counter-intuitive.