Technical Notes on the R programming language

by Sigal Blay

Index
Calling C code from R, an introduction
R Grapics using the Grid Package
snow Simplified
Inspecting R package documentation
Building R packages from source code under Windows XP - minimum installation

Calling C code from R, an introduction

The functions .C and .Call. provide a standard interface to compiled code that has been linked into R. These functions are explored in the following presentation.
Seven detailed code examples are provided.

Formats:
PowerPoint   Text file

R Graphics using the Grid Package

The grid package provides a low-level graphics system to produce reusable, editable graphical components.
Formats:
PowerPoint   Text file

snow Simplified

The 'snow' package provides a high-level interface for using a workstation cluster for parallel computations in R. Here is a friendly user guide.
Formats:
HTML   Text file

Inspecting R package documentation

(no need to check if all function arguments are documented or if a command below works - 'R CMD check' performs all these technichal tests automatically)
help(package=myPackge)   # display package DESCRIPTION file
                         # and list all functions and data sets in myPackage
help(function)           # display man/function.Rd file
example(function)        # run example in man/function.Rd
demo(package="myPackge") # list demos in package/demo
demo(demo_file)          # run demo/demo_file.R
data(package="myPackge") # list data files in package/data
help(data)               # display man/data.Rd
data(data)               # run data/data.R

Building R packages from source code under Windows XP - minimum installation:

Go to the web portal Building R for Windows.
Download and install:

Add R, tools, MinGW and HTML HELP to your PATH.
The subdirectories to add are something like:
...\R\rw2000\bin
...\tools\bin
...\MinGW\bin
...\HTML HELP WORKSHOP
   ActiveState adds Perl\bin to your path automatically
   docs says you should put tools\bin at the front of your path

To Add a directory to you PATH on Windows XP select
Control Panel -> System -> Advanced -> Environment Variables
   Directories that include spaces in their name were not a problem on my 
   system. However, on other systems you may have to do the following:
   on the Windows command prompt 
   cd to a directory that includes that directory and type
   dir /x    to find the short form of the directory name.

To install a package, type at the Windows command prompt:
R CMD INSTALL --docs=none MyPkg
   if you want to install documentations, you need to 
   download and install htmlhelp.exe

Further reading:
Building R for Windows
(the path to your R installation) .../R/rw2000/README.packages


With comments and suggestions please contact Sigal Blay (sblaysfu.ca).
This work has been made possible by the Statistical Genetics Working Group at the Department of Statistics and Actuarial Science, SFU.