Skip to content

feature request: proper inplace argument (like in Pandas) #3682

@randomgambit

Description

@randomgambit

Hello there,

Its me again. Sorry for posting all these requests but I am super excited about DT and I feel just a few extra features are missing to make DT absolutely great.

Something that I find quite annoyting when using := is that it operates in place by default. This is super annoying because during data work I create new variables all the time (for testing/exploring the data). This does not mean I want these variables to be added to my dataframe!

I know I can do something like

annoyingfunc <- function(DT){
  DT <- copy(DT)
  DT[, mytempvar := 1][]
}

but this is really not efficient at all. Could it be possible to add some inplace = FALSE like in Pandas so that the output of
DT[, newvar := 'hello', inplace = FALSE][]

prints BUT my DT is not modified? What do you think?
Thanks!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions