Managing Citations

Instead of manually inserting citations, you can use a bibtex library. For me it was the first time using bibtex and in the end I think it was really worth wile. The idea is to store your references in a different file with a specific format, such that R Markdown (Pandoc to be more specific) can access it and automatically insert it in the references. In the .Rmd file you wont find any direct citations like (Hastie, Tibshirani, and Friedman 2009), just the command [@Hastie09]. This specific reference could be stored in your bibtex file like this:

@book{Hastie09,

            author = "Hastie, Trevor and Tibshirani, Robert and Friedman, Jerome",
      
            title = "The {E}lements of {S}tatistical {L}earning",
            
            subtitle = "Data {M}ining, {I}nference, and {P}rediction",
            
            publisher = "Springer Science+Business Media",
            
            year = "2009"
}

The reference is then automatically put in the references section at the end of the thesis. However, what the citations looks like in the text and in the references is not dependent on the bibtex file. Besides your bibtex file, you also need to include a citation style language (csl) file in the YAML header. I downloaded the 6th edition apa csl from github, which you can find here.

This particular .csl will only capitalize the first word of every sentence in articles and books, however I had the requirement to capitalize every noun in the title of books, so I used curly brackets for the first letters.

The websites from which you download papers normally already provide bibtex files which you can also download and insert in your bibtex file.

References

Hastie, Trevor, Robert Tibshirani, and Jerome Friedman. 2009. The Elements of Statistical Learning: Data Mining, Inference, and Prediction. Springer Science+Business Media.