Various pieces of R-code