0

I have an R Markdown file that I repurpose to analyze new samples. Sometimes the analysis generates no significant results, and so when I try to plot the result an error is thrown. I simply want to continue to Knit the PDF if such an error occurs.

I've tried {r error = TRUE}, but the knitting still halts for some reason. Is there another knitr option that would bypass the error?

{r Gene Ontology Enrichment, include = FALSE, error = TRUE}
enrichplot::barplot(ego.MF,
        font.size = 8,
        title="GO Enrichment - Molecular Function",
        showCategory=20)
Quitting from lines 441-478 (file.Rmd) 
Error in ans[ypos] <- rep(yes, length.out = len)[ypos] : 
  replacement has length zero

1 Answer 1

0

The issue was in the knitr options of the code chunk. Evidently using include = FALSE with error = TRUE is not compatible.

Instead I switched to: {r Gene Ontology Enrichment, echo = FALSE, error = TRUE}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.