Skip to main content
R

R #

I have not used R for a long time. Proceed at your own risk.

Moved from: (Private repo) loikein/my-jupyter-notes

(Maybe) Useful resources #

Configuration #

Set language on macOS: (credit)

# (In .zshrc)

export LANG=en_US.UTF-8

Check all environment variables:

Sys.getenv()

Sys.getlocale()

Check the location of RHOME:

R RHOME

List of common packages #

Install:

## plot
install.packages("gapminder")
install.packages("dplyr")
install.packages("ggplot2")

## import
install.packages("readr")
install.packages("data.table")
install.packages("readxl")
install.packages("gdata")
install.packages("DBI")
install.packages("httr")
install.packages("jsonlite")
install.packages("haven")
install.packages("foreign")

## clean
install.packages("tidyr")
install.packages("lubridate")
install.packages("stringr")

## function
install.packages("purrr")

Load:

## plot
library(gapminder)
library(ggplot2)

## import
library(readr)
library(data.table)
library(readxl)
library(gdata)
library(DBI)
library(httr)
library(jsonlite)
library(haven)
library(foreign)

## data
library(dplyr)
library(hflights)

## clean
library(tidyr)
library(lubridate)
library(stringr)

## function
library(purrr)

## trading models
library(quantmod)

Package: base #

c() #

Append: (credit)

vector <- c()
values <- c('a','b','c','d','e','f','g')

for (v in values){
  vector <- c(vector, v)
}

Package: distr #

Make distribution: (credit)

mean <- 1
sigma <- 0.25

(n <- Norm(mean=mean,sd=sigma))

# Distribution Object of Class: Norm
#  mean: 1
#  sd: 0.25

Binder #

I have stopped using Binder. Proceed at your own risk.

Refs:

runtime.txt:

r-2018-11-16

requirements.txt:

jupyter_contrib_nbextensions

postBuild:

jupyter contrib nbextension install --user
jupyter nbextension enable toc2
jupyter trust binder-r-test.ipynb