Starting work with R

50 %
50 %
Information about Starting work with R

Published on March 9, 2014

Author: VladimirBakhrushin



Presentation on data analysis with R


General information R is an object-oriented programming language and environment. Its distinguishing feature is the existence of a large number of libraries for statistical data analysis. R is a free software with open source. Another peculiarity is that R can be used in all operating systems, particularly in Windows, Linux, Mac OS, etc. In 1997 the CRAN (Comprehensive R Archive Network ( project was created. It is a repository containing R system, libraries, materials and other related to R resources.

Starting message

Working Directory By default, the program and data are stored and looking for in the working directory. We can determine, which directory is the working, with the command: > getwd(). To change the working directory we can with the command: > setwd(“…”) In brackets it is necessary to specify the path to correct directory. In RGui it can also be done by selecting in the menu "File Change Folder".

Scripts To create programs scripts are used. They can be written with any text editor or in a special window that arises when selecting in the main menu "File - New script". To open existing scripts you must choose in the main menu: "File - Open the script."

Vectors The basic structure of R is a vector. Its elements are one or more data values of the same type. Scalar value can be represented as a vector containing a single element. More complex structures – matrices, arrays, etc. can be created from the vectors. Vector elements may belong to such data types: numeric, integer, character, complex, logical, raw etc. NaN is the result of calculations caused indeterminate forms 0/0, ∞/∞, ∞ − ∞ etc. NA is used as a symbol of uncertain at the moment value (analog of NULL for database management systems).

Creating vectors with function с()

Creating vectors with function seq()

Some functions for operating with vectors sort(x) var(x) mean(x) sum(x) Functions prod(x) max(x) min(x) length(x)

Matrices Any vector can be transformed into a matrix by specifying the way of its elements placing in this matrix. Function m=matrix(data = y, nrow = n, ncol = m) places the elements of vector y into matrix m of nm dimension so that initially the first column is filled from top to bottom, then the second, etc. If the vector length is lower then nm, its elements are used again, starting with the first. If the length of the vector is more than nm, then some of its elements remain unused . It is possible to combine two vectors into the matrix using the function c().

Creating matrixes

Creating matrices

Accessing the elements of vectors and matrices

Summation of vectors and matrixes elements

Transformation of vectors and matrices elements

Transformation of vectors and matrices elements

Arrays Vectors and matrixes are special cases of arrays having, respectively, one or two dimensions. In general, to create an array function array(<data vector>, <dimension vector>) is used. <Data vector> is the vector of numbers from which the array is formed. <Dimension vector> is a vector of length one or more giving the number of dimensions and maximal indices in each dimension.



Add a comment

Related presentations

Related pages

Words of 4 letters starting with r - More Words - Search ...

Words of 4 letters starting with r. More Words. 4 letter words starting with r 182 words. race rack racy rads raff raft raga rage ragi rags raia raid rail rain
Read more

Formazione Starting Work - Centro Formativo Starting ...

Il Centro formativo Starting Work si occupa di formazione professionale, la sede è situata a Como, in una struttura moderna pensata per l''aggiornamento e ...
Read more

Emmanuel Paradis - The Comprehensive R Archive Network

R for Beginners Emmanuel Paradis Institut des Sciences de l’Evolution Universit e Montpellier II F-34095 Montpellier c edex 05 France E-mail: paradis@ ...
Read more Terms starting with R

Here is the list of words starting with Letter R in
Read more

The list of 4 letter words starting with "R |

4 letter words starting with "R" raca, race, rach, rack, racy, rade, rads, raff, raft, raga, rage, rags, raia, raid, rail, rain, raip, rais, raja, ...
Read more

Words that start with R - You Go Rhymes!

Words starting with r. There are 4,209 words starting with the letter r. Page 2. ... Words that start with r, last updated on September 05, 2015.
Read more

Words of 6 letters starting with r - More Words - Search ...

Words of 6 letters starting with r. More Words. 6 letter words starting with r 934 words. rabato rabats rabbet rabbin rabbis rabbit rabble rabies raceme ...
Read more

4-letter words starting with r - Find Similar or Opposite ...

Looking for 4-letter words starting with r? Here's a list of words you may be looking for.
Read more

Eight letter words starting with P and ending in R ...

Following is the complete list of eight letter (8 letters) words starting with P and ending in R for domain names and scrabble with meaning.This list of 8
Read more