Git Product home page Git Product logo

r_tips's Introduction

R tips

This repository contains R programming tips covering topics across data cleaning, data visualisation, machine learning, statistical theory and data productionisation.

Many 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.

Content summary

Legend Category
๐Ÿ“š Data cleaning
๐ŸŽจ Data visualisation
๐Ÿ”ฎ Machine learning
๐Ÿ”จ Productionisation
๐Ÿ”ข Statistical theory

Tutorials

๐ŸŽจ Data visualisation

๐Ÿ“š Data cleaning

๐Ÿ”จ Productionisation

๐Ÿ”ฎ Machine learning

๐Ÿ”ข Statistical theory

Other resources

The resources below also cover a comprehensive range of practical R tutorials.

Tutorial style guide

A painful form of technical debt is inconsistent code style. This repository now contains the following file naming and code style rules.

  • Folders are no longer ordered with a numerical prefix and names are no longer case sensitive e.e.g r_tips\tutorials\... and r_tips\figures\...
  • Tutorial subtopics share the same prefix e.g. r_tips\tutorials\dv-... and r_tips\tutorials\st-...
  • File names contain - to separate file name prefixes and _ instead of other white space e.g. r_tips\figures\dv-using_diagrammer-simple_flowchart.svg
  • Comments are styled according to the tidyverse style guide:
    • The first comment explains the purpose of the code chunk and is styled differently for enhanced readability e.g. # Code as header --------
    • Comments are written in sentence case and only end with a full stop if they contain at least two sentences
    • Short comments explaining a function argument do not have to be written on a new line
    • Comments should not be followed by a blank line, unless the comment is a stand-alone paragraph containing in-depth rationale or an alternative solution
  • R code chunks are styled as follows:
    • Each R chunk should be named with a short unique description written in the active voice e.g. create basic plot and modify plot labels
    • Arguments inside code chunks should not contain white space and boolean argument options should be written in capitals e.g. {r load libraries, message=FALSE, warning = FALSE}
    • To render the github document, results are generally suppressed using results='hide' and manually entered in a new line beneath the code.
    • To render the github document, figures are generally outputed using fig.show='hold' and figure outputs can then be suppressed at the local chunk level using fig.show='hide'
  • Set a margin of 80 characters length in RStudio through Tools\Global options --> Code --> Display --> Show margin and use this margin as the cut-off for code and comments length

Citations

Citing 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.

  • R Core Team (2021). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL https://www.R-project.org/.
  • Wickham et al., (2019). Welcome to the tidyverse. Journal of Open Source Software, 4(43), 1686, https://doi.org/10.21105/joss.01686
  • H. Wickham. ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York, 2016.
  • Matt Dowle and Arun Srinivasan (2021). data.table: Extension of data.frame. R package version 1.14.2. https://CRAN.R-project.org/package=data.table

r_tips's People

Contributors

erikaduan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.