Skip to content

Should munging against data twice retaining mungepieces? #25

@robertzk

Description

@robertzk

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions