You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When assigning :=, output is given if i has no matches, whereas output is suppressed if i does have a match.
eg:
set.seed(1)
DT <- data.table(A=1:3, Val=rnorm(3))
DT[ A < 3, Val := 0] # Some rows matched, no output printed
DT[ A > 3, Val := 0] # Zero rows matched, output was printed
# A Val
# 1: 1 0.000000
# 2: 2 0.000000
# 3: 3 -0.835629
It is worth noting that this could be useful when working interactively. EG, if the user is expecting to modify the DT and output is issued it serves as an indirect/subtle warning that there was no change to the table.
This being said, if we desire that behavior perhaps we should insert a check and proper warning.
The text was updated successfully, but these errors were encountered:
When assigning
:=
, output is given ifi
has no matches, whereas output is suppressed ifi
does have a match.eg:
related to #1122
It is worth noting that this could be useful when working interactively. EG, if the user is expecting to modify the DT and output is issued it serves as an indirect/subtle
warning
that there was no change to the table.This being said, if we desire that behavior perhaps we should insert a check and proper warning.
The text was updated successfully, but these errors were encountered: