compilation failure caused by bibliography in Rstudio

I do apologise if this is a stupid question. Hope you can help out!


I just want to cite in .Rmd, but the output latex file can't be compiled normaly however hard I try.
this is the yaml:

title: "test cross-refering"
author: "name"
date: "date"
    keep_tex: true
    keep_md: true
      in_header: extarticle.tex
toc: true
toc-depth: 3
fontsize: 12pt
documentclass: extarticle
bibliography: testref.bib
geometry: margin=1in
numbersections: true
header-includes: \setlength{\parindent}{2em}
mathspec: true
abstract: abstract

the .bib is like this :

  title = {R: A Language and Environment for Statistical
  author = {{R Core Team}},
  organization = {R Foundation for Statistical Computing},
  address = {Vienna, Austria},
  year = {2019},
  url = {},

which is copied from a tutorial.

But it results in :

! LaTeX Error: Lonely \item--perhaps a missing list environment.

while the output .tex is like this (Error part):

R Core Team. 2019. \emph{R: A Language and Environment for Statistical Computing}. Vienna, Austria: R Foundation for Statistical Computing. \url{}.


It seems texlive is not able to compile this part. Obviously, it looks not very neat and normal like a common bibliography itself. Pandoc did it and I don't know why the error.

I have changed the bib file several times but it still does not work. How can I cite in R markdown correctly and efficiently?

I can't thank you enough for giving me some suggestions! :laughing: