Skip to content

Developer How To's

Pavel Balazki edited this page Aug 2, 2019 · 12 revisions

Compilation of useful information for R-developers.

Coding standards

https://github.com/Open-Systems-Pharmacology/Suite/blob/develop/CODING_STANDARDS_R.md

Useful literature

Examples of "good" packages

Examples of packages that can serve as inspiration:

Useful shortcuts

  • Show all shortcuts: Alt+Shift+K
  • Reload package: Cmd + Shift + L
  • Navigate to: Ctrl + .
  • Generate Doc: Ctrl + Shift + D
  • Run unit tests: Ctrl + Shift + T
  • Navigate to implementation: Mouse over + F2 or CTRL + Mouse Click
  • Un-/Comment line/selection: Ctrl + Shift + C
  • Multi-select: CTRL+SHIFT+ALT+M

Profiling with R-Studio

Profiling of code can be done within R-Studio with the package profvis, a descirption of the process is given here. In short, pass the code to be profiled as argument to the function profvis:

profvis({
  data(diamonds, package = "ggplot2")

  plot(price ~ carat, data = diamonds)
  m <- lm(price ~ carat, data = diamonds)
  abline(m, col = "red")
})

Graphics

Setting up Linux environment for R development

  1. Install Ubuntu

  1. Setup R and R Studio

  • Download R studio from here At the time of writing: rstudio-1.2.1335-amd64.deb

  • Then perform the followign commands

sudo apt-get install libopenblas-base r-base
sudo apt-get install gdebi
sudo gdebi rstudio-1.2.1335-amd64.deb
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libssl-dev
sudo apt-get install libxml2-dev libxslt-dev
  1. Install devtools

  • Open R studio
  • Enter command
install.packages("devtools")
  1. Install .NET Core

https://dotnet.microsoft.com/download/linux-package-manager/ubuntu18-04/sdk-current

Clone this wiki locally