Sure.
Please assume .Rmd file is a text file. Every R code which have to be executed, has to be wrapped in so called chunks which are marked as
```{r}
```
See below. Just remove > signs, which are added by citation function.
> ---
> title: "Untitled"
> output: pdf_document
> ---
>
> ```{r setup, include=FALSE}
> knitr::opts_chunk$set(echo = TRUE)
> library(palmerpenguins)
> library(tidyverse)
> library(ggplot2)
> ```
>
> ## R Markdown
>
> This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
>
> ```{r penguins}
> data("penguins")
>
> # A draft to check the plots results
> summary = penguins %>%
> group_by(island) %>%
> count(species)
> summary
> ```
>
> ## Including Plots
>
> You can also embed plots, for example:
>
> ```{r pressure, echo=FALSE}
> ggplot(penguins) + geom_col(mapping = aes(flipper_length_mm, body_mass_g))
> ```
Please note, that in .Rmd you can write any sentence outside chunk without # comment tag. In markdown # is used to create paragraphs and subparagraphs.