How R and R-Studio can make the writing manuscripts easy for several journals

An introduction to latex in R and R-Studio

Neeraj Dhanraj
5 min readJul 2, 2020
Photo by Stephen Phillips - Hostreviews.co.uk on Unsplash

Background

In earlier posts, we have already discussed how using an R language is beneficial to the researchers in several ways (here). It provides many benefits such as reproducible research, greater visualization, and a huge audience for your research. Also, we have discussed how and where the research contributed in the R can be published in reputed journals, here.

Now, consider, you are ready with some research contribution in the R and now in a position to draft a manuscript for the methodology or the R package.

If it is a methodology implemented in R and you wish to discuss its performance in your manuscript. In such a case, you may start with an introduction, literature review, proposed methodology sections followed by the results, performance evaluation, and plots you achieved in the R. Finally, you may conclude the manuscript with some remarks. If it is so, you will start by writing all the texts in the respective sections, citations, tables, equations, and figures. These figures and tables can be the output of the analysis done in R. If you are willing to draft the manuscript in LaTeX in the traditional way, you will chalk out all analysis and make a table in the Latex, and you may upload the same figure produced in the R study.

Consider it is a manuscript introducing an R package, the manuscript will be full of R code chunks, R function descriptions, and respective case studies with output plots. It can be really challenging for authors to draft such kind of manuscript with code chunks and other R material in traditional latex format of the journals. You might have observed in several articles, some of them have written the codes very much similar to the original format and fonts, but many of them failed to do so. To avoid the code chunks in the manuscript, some authors preferred to provide the code as a supplement material.

This situation can be explained in other words as a researcher is ready with codes, desired results, and plots, but he/she can not use this content directly to his/her manuscript. Rather, he/she needs to save the results outside the R-Studio and then to embed it in the latex of the manuscript.

To avoid such a situation, this post is demonstrating how R and R-Studio can be used to write a manuscript for several journals with minimum efforts and how the R codes chunks and corresponding output can be directly embedded in the manuscript.

Writing a journal article with R-Studio

We are going to use a rticles package to write a journal article in the R-Studio. The procedure is explained step-by-step with the following points:

  1. Install and load rticles package in R studio with following instructions.

2. Loading the rticles package in the R-Studio adds several journal formats in the workspace. It is important to understand where to find these formats. These journal formats are accessible through the RMarkdown files. Let’s access it:

Go to File > New File > R Markdown

It will pop-up the following window:

3. Input the Title of the article and the name of the author and then click on ‘From Template’ to access the templates/journal formats available in R Markdown and rticles package.

5. The available (default) templates in R Markdown and rticles are as follows:

6. You can see, most of the major publishing journal templates are available in rticles package. Now, select the desired journal template out of this list. I am selecting the ‘R journal Submission’.

This will generate the R Markdown file (.Rmd) in the R-Studio IDE. You can see it in the following figure:

7. Now, it is very convenient to use the R Markdown file in a conventional way. Mention the title of the article, details of authors, abstract, and all other text sections in the R Markdown file. In the default case, the .Rmd file has an Introduction, followed by two more sections and Summary sections. You can add more sections and sub-sections with the conventional syntax of the R Markdown. In one of the sections, you can find a code chunk. This .Rmd file generates the journal template with suitable texts, code chunks, and the corresponding results or plots into a PDF file with the desired journal template.

8. Also, it will generate a LaTeX folder in the project, which can be accessed in any of the LaTeX editor or IDE and can be updated further. The benefit of using this LaTeX folder will be that, it will automatically include the code chunks, outputs, and plots directly, as these were obtained in the R study. So, eventually, it reduces the efforts significantly while using the R results in your journal articles.

I hope, this information may help you in reducing your efforts in drafting your next manuscript with the R results. Feel free to comment on this post for further details.

Author:

Dr. Neeraj Dhanraj Bokde

Postdoctoral Researcher,

Aarhus University, Denmark

https://www.researchgate.net/profile/Neeraj_Bokde

--

--