### R language for scientist

## Bioinformatics Education - R language for scientistR is a language and environment for statistical computing and graphics. It is a GNU project which is similar to the S language and environment which was developed at Bell Laboratories (formerly AT&T, now Lucent Technologies) by John Chambers and colleagues. R can be considered as a different implementation of S. There are some important differences, but much code written for S runs unaltered under R. R provides a wide variety of statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering, ...) and graphical techniques, and is highly extensible. The S language is often the vehicle of choice for research in statistical methodology, and R provides an Open Source route to participation in that activity. One of R's strengths is the ease with which well-designed publication-quality plots can be produced, including mathematical symbols and formulae where needed. Great care has been taken over the defaults for the minor design choices in graphics, but the user retains full control. |

## Logical vectorsAt 2013-08-27 08:48:17 PM As well as numerical vectors, R allows manipulation of logical quantities. The elements of a logical vector can have the values > temp <- x > 13 sets The logical operators are |

## Simple manipulations; numbers and vectors - Generating regular sequencesAt 2013-08-27 08:47:28 PM R has a number of facilities for generating commonly used sequences of numbers. For example The construction The function Parameters to For example > seq(-5, 5, by=.2) -> s3 generates in > s4 <- seq(length=51, from=-5, by=.2) generates the same vector in The fifth parameter may be named A related function is > s5 <- rep(x, times=5) which will put five copies of > s6 <- rep(x, each=5) which repeats each element of |

## Simple manipulations; numbers and vectors - Vector arithmeticAt 2013-08-27 08:44:05 PM Vectors can be used in arithmetic expressions, in which case the operations are performed element by element. Vectors occurring in the same expression need not all be of the same length. If they are not, the value of the expression is a vector with the same length as the longest vector which occurs in the expression. Shorter vectors in the expression are > v <- 2*x + y + 1 generates a new vector The elementary arithmetic operators are the usual sum((x-mean(x))^2)/(length(x)-1) or sample variance. If the argument to
To work with complex numbers, supply an explicit complex part. Thus sqrt(-17) will give sqrt(-17+0i) will do the computations as complex numbers. |

## Simple manipulations; numbers and vectors - Vectors and assignmentAt 2013-08-27 08:43:32 PM R operates on named > x <- c(10.4, 5.6, 3.1, 6.4, 21.7) This is an A number occurring by itself in an expression is taken as a vector of length one. Notice that the assignment operator (‘ ’ (“less than”) and ‘`<` ’ (“minus”) occurring strictly side-by-side and it ‘points’ to the object receiving the value of the expression. In most contexts the ‘`-` ’ operator can be used as an alternative. Assignment can also be made using the function `=` `assign()` . An equivalent way of making the same assignment as above is with:> assign("x", c(10.4, 5.6, 3.1, 6.4, 21.7)) The usual operator, Assignments can also be made in the other direction, using the obvious change in the assignment operator. So the same assignment could be made using > c(10.4, 5.6, 3.1, 6.4, 21.7) -> x If an expression is used as a complete command, the value is printed > 1/x the reciprocals of the five values would be printed at the terminal (and the value of The further assignment > y <- c(x, 0, x) would create a vector |