Bibliography Style Vignette in R - r

I am developing vignette for a package in r and wish to include some citations in the document. I want the citations to look like this `Author (year) unfortunately what I have is (Author year)
---
title: "MNP: My New Package"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{MNP}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
bibliography: "economia.bib"
logo: logo.png
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
```{r setup}
library(MNP)
```
## Statement of the Research Problem
### Introduction
- [#Hall1995] and [#Politis2004]
This is what I have

Related

Can't knit the R file that I am trying to make

So I have a document where I'm trying to knit, but I get an error where it says that
Error: object 'r' not found
Execution halted
Here is my full code:
---
title: "Test"
author: "Test Test"
date: "05.15.2022"
output:
html_document:
toc: yes
toc_float: yes
editor_options:
markdown:
wrap: sentence
---
# Header
##chunks
```{r}
summary(cars)
```
```{r}
knitr::opts_chunk$set(message = FALSE,warning = FALSE, error = FALSE)
```
```{r}
sapply(cars,class)
```
Any help? I am really new to R.

RMarkdown is not referencing tables

Somehow my RMarkdown document is not crossreferencing tables or figures. Here is a stripped down version of my document.
---
title: "Test"
author: "Me"
date: "01/04/2022"
output: bookdown::pdf_document2
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
var1<-sample(LETTERS)
tab1<-table(var1)
My table is in Table \#ref{tab:tab1}
library(knitr)
kable(tab1, caption="my table")
AS we see in Figure \#ref{fig:plot1}
plot(seq(1,10,1))
You should call your tab1 in the code chunk like this {r tab1}. And use () instead of {} for your #ref. In that case it reference to your figures and tables. You can use the following code:
---
title: "Test"
author: "Me"
date: "01/04/2022"
output: bookdown::pdf_document2
---
My table is in Table \#ref(tab:tab1)
```{r tab1, echo =FALSE}
var1<-sample(LETTERS)
tab1<-table(var1)
library(knitr)
kable(tab1, caption="my table")
```
\newpage
AS we see in Figure \#ref(fig:plot1)
```{r plot1, fig.cap ="plot", echo=FALSE}
par(mar = c(4, 4, .2, .1))
plot(seq(1,10,1))
```
Output:
As you can see on the image, when you click on 1 in will go to your table.

R Markdown internal link to tables

Is there a possibility to create an internal link to a table in a rmarkdown-article?
I would like to click on this link and then I automatically come to my table.
I want to set the internal link in the text in the Empirical Results-part for table_1.
I've already tried [#table_1] but it doesn't work.
can someone help me?
Here is my example code:
---
title: "title"
subtitle: "subtitle"
author: "me"
date: "`r format(Sys.time(), '%B %d, %Y')`"
keywords: "keywords"
output:
pdf_document:
fig_cap: yes
keep_tex: yes
documentclass: article
capsize: normalsize
fontsize: 11pt
geometry: margin=1in
spacing: doublespacing
footerdate: yes
abstract: 'Insert abstract here'
---
\newcommand*{\keywords}[1]{\textbf{\textit{Keywords---}} #1}
\keywords{keywords}
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
##required packages
library(tidyverse)
library(knitr)
library(kableExtra)
```
# Introduction
# Literature review
# Data and Methodology
# Empirical Results
In table_1 you can see something....
[#table_1]
# Conclusions
\newpage
# References
\newpage
# Appendix
```{r echo=F, warning=F, message=F}
df1 <- tibble(column1= 1:10, column2=11:20)
table_1 <-df1%>%kable("latex",
booktabs=T,
caption = "example table")%>%
kable_styling(latex_options = "hold_position")
table_1
```

How to Create Full Width Figures When Using the "twocolumn" "classoption" for Knitr to PDF?

How can one create a full width figure when using the twocolumn class option in knitr / R / RMarkdown / LaTex?
Based on the Knitr documentation, I've tried two approaches. Nothing short of editing the .tex file has worked for me so far.
This:
---
output: pdf_document
classoption: twocolumn
header-includes:
- \usepackage{lipsum}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
\lipsum[1-2]
```{r fig.env = "figure*", fig.cap = "Test"}
plot(runif(10))
```
\lipsum[3-5]
```{r fig.fullwidth = T}
plot(runif(10))
```
Results in this:
Yihui has fixed this in the development version of knitr. Yihui's response:
The option fig.env = 'figure*' should be respected now (in the dev version of knitr). But the plot will float to a new page. I guess that is a LaTeX issue orthogonal to knitr. Thanks!
Don't forget that you must include a caption for this to work.
---
output: pdf_document
classoption: twocolumn
header-includes:
- \usepackage{lipsum}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
\lipsum[1-3]
```{r fig.env = "figure*"}
plot(runif(10))
```
\lipsum[2]
```{r fig.env = "figure*", fig.cap = ""}
plot(runif(10))
```
\lipsum[2]

How to include DiagrammeR/mermaid flowchart in a Rmarkdown file

I have an R markdown file:
---
title: "Untitled"
author: "Me"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document.
As well as a DiagrammeR/mermaid chart:
graph LR
A-->B
How can I add the chart in the R-markdown?
Actually it is trivial:
---
title: "Untitled"
author: "Me"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document.
```{r}
library(DiagrammeR)
mermaid("
graph LR
A-->B
")
```

Resources