Resources for R

Resources for R

R program:   

R Manuals:  

R Introduction (read these documents!):

R Description of tools and packages to tackle “tasks”:

Econometrics and Time Series with R

Time series objects

R for Data Science - handbook

Matrix and vector instructions

R time series textbook with examples and a package (Shumway and Stoffer)

R book - Statistics and Data Analysis for Financial Engineering with R Examples (Ruppert and Matteson)

R for Time Series Analysis:

Econometrics course with R

Packages for options and time series applications

Sign restricted VARs

## Installing packages to directory with read/write access

## A package is a collection or group of objects that R can use.

## A package might contain functions, data frames, or other objects,

## such as dynamically loaded libraries (DLLs) of compiled code.

## Often, the terms package and library are used interchangeably.

## R configure_default.R (no longer needed ver 3.4)   library(utils)

## Using Internet Explorer proxy settings is often helpful in IT controlled environment  (no longer needed)   setInternet2(TRUE)

## To Install R packages on a lab machine, we need to use a folder such as u:\R_package,## for which we have read/write access. The commands are:

## Set default directory for user installed packages, but first create the folder u:\R_package using Windows explorer.

.libPaths(c("u:\\R_package", .libPaths()))

## Pre-select my nearest CRAN mirror in Kansas

options(repos='http://rweb.quant.ku.edu/cran/')

## To install package fPortfolio, for example:

install.packages("fPortfolio",lib="u:\\R_package")

## To load the package at the start of your R program:

library("fPortfolio", lib.loc="u:\\R_package")

## To view an alphabetical list of libraries available in R, type

library().

## To view an alphabetical list of packages available in R, type

search().

## Each time that you start R, run this command to make this directory the default for additional ## packages to install, and put it at the front of search path:

.libPaths(c("u:\\R_package", .libPaths()))

To update packages after upgrading R:

For most people the best thing to do is to uninstall R (see the previous Q), install the new version, copy any installed packages to the library folder in the new installation, run update.packages(checkBuilt=TRUE, ask=FALSE) in the new R and then delete anything left of the old installation. Different versions of R are quite deliberately installed in parallel folders so you can keep old versions around if you wish.

For those with a personal library (folder R\win-library\x.y of your home directory, R\win64-library\x.y on 64-bit builds), you will need to update that too when the minor version of R changes (e.g. from 3.0.2 to 3.1.0). A simple way to do so is to copy (say) R\win-library\3.0 to R\win-library\3.1 before running update.packages(checkBuilt=TRUE, ask=FALSE).

Example of graphics R:

library(graphics)

example(plot)

example(barplot)

example(boxplot)

example(dotchart)

example(coplot)

example(hist)

example(fourfoldplot)

example(stars)

example(image)

example(contour)

example(filled.contour)

example(filled.contour)

example(persp)  **