Various personal R code