Skip to content

Should setnames() produce duplicate column names without warning? #4044

@sindribaldur

Description

@sindribaldur
IRIS  <- as.data.table(iris)
setnames(IRIS, "Petal.Length", "Sepal.Length") # No warning (but maybe there should be?)
IRIS[, Sepal.Length] # Only first occurrence is returned
setnames(IRIS, "Sepal.Length", "abc.Length") #  Warning: Only first occurrence is changed

Has been discussed at length here. Without conclusion?

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