I have the following data.table:
dt <- data.table(col1 = rep("a",6), col2 = c(1,1,1,2,3,1))
Now I want to replace all the 1 in col2 with value "bigDog". I can do it using the data.frame spirit:
dt$col2[dt$col2==1,] <- "bigDog"
But I wonder if there is a different way, more "data.table oriented"?