Box-Ljung test
data: <some data>
X-squared = NA, df = 20, p-value = NA.
Pvalues and Xsquared are coming as N/A, but my data values doesn't have any zero.
As you don't have NA's in your data (Ljung Box test can't handle missing values), we will take a random example, assuming that it is a time series :
data <- c(12,45,48,31,12,7,78)
We get (setting our lag to 20) :
Box.test(data, lag = 20, type = "Ljung-Box", fitdf = 0)
Box-Ljung test
data: data
X-squared = NA, df = 20, p-value = NA
Kinda logical to get a NA as we are setting a lag higher than the length of our time series.
Now, we will change our lag and setting it to 1.
Box.test(data, lag = 1, type = "Ljung-Box", fitdf = 0)
Box-Ljung test
data: data
X-squared = 0.30832, df = 1, p-value = 0.5787
I think that your lag (20) is higher than the length of your time series (as it is here with the short example).
See ?Box.test
or wikipedia for more information.