Skip to content

Mutated data.tables are not printed when enclosed in parentheses. #7360

@eliocamp

Description

@eliocamp

The walrus operator suppresses printing, but calling print explicitly does work.

library(data.table)
dt <- data.table(x = 1)

print(dt[, a := "a"])
#>        x      a
#>    <num> <char>
#> 1:     1      a

However, I woudl've assumed that enclosing the expression in parentheses would also work. It doesn't!

(dt[, a := "a"])

Created on 2025-10-05 with reprex v2.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions