# Mann Kendall test in R with missing data

I am trying to run a Mann Kendall test on community dissimilarity for streams sampled roughly monthly, but with NA values for some months where conditions prevented data collection. From what I am reading, the Mann Kendall test should be able to handle these missing values, but I am getting the following error.

> mk.test(dissim.avg.ts,alternative="greater", continuity=F)
Error in na.fail.default(x) : missing values in object


Can anyone explain to me what is causing the problem here and how to address it?

• I cannot find the source of your claim should be able to handle these missing values, are you sure this is true? Have you tried manually removing the missing values? – user2974951 Dec 20 '18 at 6:36
• There shouldn't be any issue making the calculations in general, although the performance of the test will suffer with increasing numbers of missing values. The following link is where I had read about the specific tests in R, but on closer inspection, it's not clear if that part of the text refers to the trend or kendall package. However, it's a time series data set, so when I remove the values before creating the time series, it bumps data points up to fill in the gaps. – Avery Scherer Dec 21 '18 at 18:39