I am trying to get the results of my manova by using the following code from the car package. However I get two error messages (from the getManova function):

- Error in eigen(qr.coef(if (repeated) qr(x$SSPE[[term]]) else SSPE.qr, : infinite or missing values in 'x'
- Error in getManova(av) : singular error SSP matrix; multivariate tests unavailable try summary(object, multivariate=FALSE)

I am running my manova by permuting it 1000 times, and I obtain the error at different random permutations each time. I have checked my original data and it does not contain NaNs nor infinite values.

How could I fix this issue?

```
av <- Manova(lmfit, idata = idata, idesign = ~emotion*frequency,type="III");
stat<-getManova(av);
getManova <- function (x)
{
if ((!is.null(x$singular)) && x$singular)
stop("singular error SSP matrix; multivariate tests unavailable\ntry summary(object, multivariate=FALSE)")
test <- x$test
repeated <- x$repeated
ntests <- length(x$terms)
tests <- matrix(NA, ntests, 4)
if (!repeated)
SSPE.qr <- qr(x$SSPE)
for (term in 1:ntests) {
eigs <- Re(eigen(qr.coef(if (repeated) qr(x$SSPE[[term]]) else SSPE.qr,
x$SSP[[term]]), symmetric = FALSE)$values)
tests[term, 1:4] <- switch(test, Pillai = stats:::Pillai(eigs,
x$df[term], x$error.df), Wilks = stats:::Wilks(eigs,
x$df[term], x$error.df), `Hotelling-Lawley` = stats:::HL(eigs,
x$df[term], x$error.df), Roy = stats:::Roy(eigs,
x$df[term], x$error.df))
}
ok <- tests[, 2] >= 0 & tests[, 3] > 0 & tests[, 4] > 0
ok <- !is.na(ok) & ok
tests <- cbind(x$df, tests, pf(tests[ok, 2], tests[ok, 3],
tests[ok, 4], lower.tail = FALSE))
rownames(tests) <- x$terms
colnames(tests) <- c("Df", "test stat", "approx F", "num Df",
"den Df", "Pr(>F)")
tests <- structure(as.data.frame(tests), heading = paste("\nType ",
x$type, if (repeated)
" Repeated Measures", " MANOVA Tests: ", test, " test statistic",
sep = ""), class = c("anova", "data.frame"))
#print(tests)
invisible(x)
return(tests)
}
```