Problem in Knitting a R Markdown File:

While knitting my R Markdown file, I am facing the following error:

Quitting from lines 22-26 [unnamed-chunk-2] (R-Coding.Rmd)

Error in check_for_XQuartz():
! X11 library is missing: install XQuartz from www.xquartz.org
Backtrace:

  1. utils::View(penguins)
  2. utils:::check_for_XQuartz(file.path(R.home("modules"), "R_de.so"))
    Execution halted

Did the error message go away after you installed XQuartz?

I cannot install XQuartz. When I try to install this package, an error appears which states " the object not found"

FWIW XQuartz is not a package. This is something you need to install on the system when using R on Mac OS
See R for macOS