Assuming you have the right packages installed, this should be a MWE from the klippy website here
tf <- tempfile(fileext = c(".Rmd", ".html"))
writeLines(
c("```{r klippy, echo=FALSE, include=TRUE}",
"klippy::klippy()",
"```",
"Insert this chunk in your `Rmd` file:",
"````markdown",
"`r ''````{r klippy, echo=FALSE, include=TRUE}",
"klippy::klippy()",
"```",
"````"
),
tf[1]
)
# NOT RUN {
rmarkdown::render(tf[1], "html_document", tf[2])
browseURL(paste0("file://", tf[2]))
# }