A repository of R usage tips for data cleaning, data mining, data visualisation, statistical inference and machine learning
ggplot2
using volcano plots (Updated)DiagrammeR
to draw flow charts (Updated)data.table
or tidyverse
(or Python Pandas
) (Updated)stringr
(Updated)The resources below also cover a comprehensive range of practical R tutorials.
This repository now contains the following file naming and code style rules.
r_tips\tutorials\...
and r_tips\figures\...
r_tips\tutorials\dv-...
and r_tips\tutorials\st-...
-
to separate file name prefixes and _
instead of other white space e.g. r_tips\figures\dv-using_diagrammer-simple_flowchart.svg
# Code as header --------
create basic plot
and modify plot labels
{r load libraries, message=FALSE, warning=FALSE}
results='hide'
and manually entered in a new line beneath the code.fig.show='markdown'
and figure outputs can then be suppressed at the local chunk level using fig.show='hide'
Tools\Global options --> Code --> Display --> Show margin
and use this margin as the cut-off for code and comments lengthCiting packages is a good practice when you are publishing research papers. To do this, use citations("package")
to print the relevant package publication. A non-exhaustive list of R packages used in this repository is found below.
tidyverse
. Journal of Open Source Software, 4(43),ggplot2
: Elegant Graphics for Data Analysis. Springer-Verlag New York, 2016.data.table
: Extension of data.frame
. R packageMany kudos to Dr Chuanxin Liu, my former PhD student and code editor, for teaching me how to code in R in my past life as an immunologist.