Academic paper

Author
Affiliation

Chung-hong Chan

GESIS

Published

2023-06-20

Anatomy of an academic paper

Simply put, a (reproducible) academic paper is a single qmd file with the following:

  • Standardized format (APA, PLOS, etc.)
  • Citation / Bibliography (APA, Harvard, etc. Usually the same as the format)
  • Figures and tables (hopefully generated from computation) and cross-referencing them (Table 1, Figure 1 etc.)

The major advantage of Quarto is to standardize all three (rather than doing them manually, when any of these things is to be changed).

The file format required is usually PDF or Microsoft Word.

Standardized format

There are templates (as Quarto extensions) available (Official list, some other: APA7, arXiv, CCR).

Activity

Q:Suppose you want to use the Journal of Statistical Software extension (quarto-journals/jss), Applying your knowledge from Session 5 and Session 6, how to initialize a project?

A:

## suppose we want the paper to be in a directory `mypaper`
quarto use template quarto-journals/jss
cd mypaper
ls

Immediate render

In general, it is a good idea to immediate render the default article to check whether the template requires external R and/or LaTeX packages.

quarto render mypaper.qmd

The template (mypaper.qmd in this case) usually contains important information on how to write a paper with it. I usually keep it until a point I don’t need that information anymore.

Let’s get our hands dirty

Exercise

Edit the YAML Front Matter so that:

  1. You and a person you’d like to collaborate with are the authors
  2. Edit the title to a paper you’d like to write
  3. Write a few sentences in the abstract
  4. Change the keywords and running head

And render. And now you have your own JSS paper… ish.

Citation

Quarto uses BibTeX to handle citation. By default, this JSS template looks for bibliography.bib. But you can change that in the YAML.

A BibTeX file is a plain-text file with BibTeX entries. You can keep track of your bibliographic library using external tools (Zotero or whatnot). This workshop is not about bibliography management, so we will manage the BibTeX file manually.

Suppose you want to cite this paper (you should). You need to have the BibTeX entry of this paper. The BibTeX entry of the paper is like this:

@article{schoch2023software,
  title={Software presentation: Rtoot: Collecting and Analyzing Mastodon Data},
  author={Schoch, David and Chan, Chung-hong},
  journal={Mobile Media \& Communication},
  pages={20501579231176678},
  year={2023},
  publisher={SAGE Publications Sage UK: London, England}
}

Of course, we can enter this information manually. But the speediest way to obtain this is to search for the title in Google Scholar, click “Cite”, and then “BibTeX” 1. Copy and paste the entry into bibliography.bib and save.

Now, you can cite the paper. In the BibTeX entry, the first element (schoch2023software in the above example) is the cite key of the entry. It is the identifier of an entry and should be unique in a BibTeX file.

In the body, you can cite a paper using one of the following format:

<!-- Style 1 -->

@schoch2023software develop an R package for collecting Mastodon data.

<!-- Style 2 -->

`rtoot` [@schoch2023software] is an R package for collecting Mastodon data.

<!-- Style 3 -->

Many R packages have been developed to collect social media data [e.g. @schoch2023software].

<!-- Style 4 -->

@schoch2023software [p.1] state that "Mastodon will become increasingly more relevant for communication scholars."

Exercise 1

Try out all four styles and explain to me what are the differences between the four.

Exercise 2

Find this paper: “rtweet: Collecting and analyzing Twitter data” by Kearney, and cite it in the following sentence instead.

Many R packages have been developed to collect social media data [e.g. @schoch2023software].

Exercise 3

The syntax for citing multiple papers is: [@citekey1;@citekey2]. Try to cite both Schoch & Chan and Kearney in the above sentence.

tables, figures and cross referencing

Recalling yesterday, we can create tables and figures with code chunk.

```{r}
#| echo: false
#| tbl-cap: Some outdated car data
knitr::kable(mtcars)
```

We can do the same in your paper too. The tricky part is to cross-reference the generated content. You can cross-reference them manually (e.g. typing exactly “Table 2”), but there is a better way.


@tbl-mtchars shows some outdated car data.

```{r}
#| label: tbl-mtcars
#| echo: false
#| tbl-cap: Some outdated car data
knitr::kable(mtcars)
```

Quarto takes care of code chunks labeled with tbl- and fig-.

Exercise 1

Create a code chunk to generate the histogram and cross-reference it.

Labeling non-computational parts

It’s better to download the image file.

*Felis catus* (@fig-cat) does not have nine lives. @tbl-cats shows the number of lives of three known cats.

![A picture of Felis catus](Cat_August_2010-4.jpg){#fig-cat}

| Cat           | Number of lives |
|---------------|-----------------|
| Hello Kitty   | 1               |
| Felix the cat | 1               |
| Garfield      | 1               |

: List of known cats and their number of lives {#tbl-cats}

Debrief

Q: How to display x as a table?

A: The way to answer this kind of questions is to find a way to make x a data frame. Chances are, you can either use as.data.frame() or broom::tidy() for that. Whether or not it’s pretty is another issue.

mod <- glm(mpg ~ wt + cyl, data = mtcars)
knitr::kable(broom::tidy(mod))
term estimate std.error statistic p.value
(Intercept) 39.686262 1.7149840 23.140893 0.0000000
wt -3.190972 0.7569065 -4.215808 0.0002220
cyl -1.507795 0.4146883 -3.635972 0.0010643

Q: I am tired of JSS. I want to submit it to an Elsevier journal.

A: No!

Q: Okay. How about PLOS One? You did that too, right?

A: Okay… Changing a template can be dangerous. Please backup first (or use version control).

quarto install extension quarto-journals/plos

You can test that with

quarto render myarticle.qmd --to plos-pdf

You will need to edit the in-text citations (PLOS One does not use author names). You can change that permanently by changing the YAML.

format:
  plos-pdf:
    keep-tex: true

Q: I want to submit my paper to ICA. I need my paper in APA7.

A: An experimental Quarto APA7 template is available. But please make sure you read carefully how it works. In particular, it doesn’t use tbl- and fig- labels for cross-referencing.

Q: Why don’t you teach the visual editor of RStudio? It’s great!

A: I agree. It can even support citing papers from your Zotero library. But I want you to understand the mechanism.

Footnotes

  1. Using this method, the entry has no DOI. But again, this session is not about bibliography management. If you really want to have the DOI, the best way is to use crossref meta search. But that’s super sluggish. Also, you need to manually edit the obtained entries sometimes.↩︎