I don't know why but recently I cannot assign NA values to specific indexes of a data frame without getting a fatal error. I didn't have this problem in the past. My code was working perfectly exactly as it is now. I didn't change a single chunk. However, when I try to run the following chunk of code:
NaN_PFT_ID <- which(is.na(values(preds_present_cut$value_1))) # NaN_PFT_ID is just a vector with positions of the NA values
preds_present_cut[NaN_PFT_ID] <- NA #here is where the fatal error always occurs
I cannot understand why I now get this fatal error since this is a very basic command. The data frame is big but it used to work anyway, so I don't think it's a RAM issue. I have tried running the code with the latest version of R and Rstudio but also with older ones and the problems persist.
Thank you in advance for your help.
Sincerely,
Anastasios