-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Current behavior is like
data.table(a=1:2, b=0L)[2L, b:="2"][]
a b
1: 1 0
2: 2 2
#Warning message:
#In `[.data.table`(data.table(a = 1:2, b = 0L), 2L, `:=`(b, "2")) :
# Coercing 'character' RHS to 'integer' to match the type of the target column (column 2 named 'b').There is a comment
// this "Coercing ..." warning first to give context in case coerceVector warns 'NAs introduced by coercion'
Do we really want to raise warning here? If RHS is of not-coercible to LHS we get a warning for that
data.table(a=1:2, b=0L)[2L, b:="asd"]
#Warning messages:
#1: In `[.data.table`(data.table(a = 1:2, b = 0L), 2L, `:=`(b, "asd")) :
# Coercing 'character' RHS to 'integer' to match the type of the target column (column 2 named 'b').
#2: In `[.data.table`(data.table(a = 1:2, b = 0L), 2L, `:=`(b, "asd")) :
# NAs introduced by coercionIf we want to retain the warning even for coercible character, then we should add an option internally to disable that warning, so memrecycle can be used for such coercion.