I used the := in R to perform some manipulations in my data set but the usage which I am implementing throws an error.
I tried using other functions like c() for creating subsets but I need something efficient and apparently := should do the job for me. With the subset function, I have a lot of intermediate data frames which are of course unnecessary.
#preprocessing steps for getting rid of the null values rows
df_data[Quantity<=0,Quantity:=NA]
df_data[UnitPrice<=0,UnitPrice:=NA]
df_data <- na.omit(df_data)
(from the console):
> df_data[Quantity<=0,Quantity:=NA]
Error in `:=`(Quantity, NA) :
Check that is.data.table(DT) == TRUE. Otherwise, := and `:=`(...) are defined for use in j, once only and in particular ways. See help(":=").