I need to do a for loop and a true or false operation for each cell value in the table, if operation returns true, then the function is going to replace the value with 0. But the R throws me errors everytime i try to run the code
for (i in xxxxx(a number){
for (j in xxx(a number){
if (y[i,j] == 0 & y[i,j] < mean(y) - ppp / sd(y)){
y[i,j] <- NA
}
}
}
Error in [.data.table(y, i, j) : j (the 2nd argument inside [...]) is a single symbol but column name 'j' is not found. Perhaps you intended DT[, ..j]. This difference to data.frame is deliberate and explained in FAQ 1.1.
xxxxxand thexxxfunctions? Further, R won't accepta numberas an input so this is probably mot the code that you run. It is easier to answer if your example is reproducible and you show the expected output. - machine