03 Lesson 1A

LESSON-1A

by A. Mani

Introduction:

See ''scistatRred.pdf'', below and http://cran.r-project.org/doc/manuals/R-intro.pdf .

Installation:

For most ordinary purposes, there is no special need to compile R from source. Simply use the packages provided by your Linux/ BSD distribution. Install core packages and any number of ''R libraries''. Some libraries may not be available in your distribution.

#su


#R
>install.packages()

Getting Help:

#R

#help.start() - For html help

#help(command)

#help(plot)


You can search cran and also subscribe to their various (high traffic) mailing lists.

IDE:

> library (Rcmdr)


This is how you start Rcmdr (or load a package into R).
Rcmdr is useful for running and debugging code, but not exactly for writing it. You will however need to learn CLI methods as well.

Recommended Editors: Emacs, Kate, Vim or any of your favourite programming editors (with mark up for R)

R Scripts :


R scripts need to saved with .R extension.

Example : sym.R

> x <- 5+9*5

> x

You can do this on the CLI or put them on a file and ''source'' them.

Exercise-1: Do it.

Exercise-2: Write a R script including all arithmetic operations.

Exercise-3: Explain each LOC in the following:

>x <- c(1,3,7, 9, 2)

>is.integer(x)

>y <- as.integer(x)

>y

>z <- (as.vector(x))*(as.vector(x))

>z