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
David Lawrence Miller edited this page Oct 3, 2013
·
2 revisions
When attempting to calculate the variance using dsm.var.prop or dsm.var.gam you may come up against the following error:
Error in if (x0[i] == 0) 1 else x0[i] :
missing value where TRUE/FALSE needed
This occurs because the prediction data set you're using has NA values for one or more covariate(s) in one or more cells. Removing those prediction cells will remove this problem.
The following code will remove any rows of the variable pred that have NA values. One should be careful to ensure that pred only has the variables that are being used for prediction in it and that extra rows are not removed by NAs in columns that are not used in prediction.
pred <- pred[apply(pred,1,function(x){!any(is.na(x))}),]
This is a temporary work-around and will be fixed in the next version of dsm.