SlideShare a Scribd company logo
GETTING STARTED WITH R:
VARIABLES, VECTORS, MATRICES

Vladimir E. Bakhrushin,
Professor, D. Sc.
Vladimir.Bakhrushin@gmail.com
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
(http://cran.r-project.org) 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.
Arrays
Arrays

More Related Content

What's hot

Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
Zaid Shabbir
 
Data structure and its types
Data structure and its typesData structure and its types
Data structure and its typesNavtar Sidhu Brar
 
introduction to Data Structure and classification
 introduction to Data Structure and classification introduction to Data Structure and classification
introduction to Data Structure and classification
chauhankapil
 
Data structures (introduction)
 Data structures (introduction) Data structures (introduction)
Data structures (introduction)Arvind Devaraj
 
double linked list
double linked listdouble linked list
double linked list
MAHALAKSHMI P
 
Data structure and its types
Data structure and its typesData structure and its types
Data structure and its typesNavtar Sidhu Brar
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure ppt
NalinNishant3
 
Data structure and its types.
Data structure and its types.Data structure and its types.
Data structure and its types.
buyinstagramfollowersaustralia
 
Introduction to data structure by anil dutt
Introduction to data structure by anil duttIntroduction to data structure by anil dutt
Introduction to data structure by anil dutt
Anil Dutt
 
Data structure
Data structureData structure
Data structure
Prof. Dr. K. Adisesha
 
Datastructureitstypes
DatastructureitstypesDatastructureitstypes
Datastructureitstypes
soniasharmafdp
 
Introduction of data structure
Introduction of data structureIntroduction of data structure
Introduction of data structureeShikshak
 
Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Data structure,abstraction,abstract data type,static and dynamic,time and spa...Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Hassan Ahmed
 
Presentation on Data Structure
Presentation on Data StructurePresentation on Data Structure
Presentation on Data Structure
A. N. M. Jubaer
 
Data structure
 Data structure Data structure
Data structure
Shahariar limon
 
Lecture 1 and 2
Lecture 1 and 2Lecture 1 and 2
Lecture 1 and 2
SaheedTundeZubairSTA
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
adeel hamid
 
DATA STRUCTURE
DATA STRUCTUREDATA STRUCTURE
DATA STRUCTURE
Rohit Rai
 

What's hot (20)

Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
 
Data structure and its types
Data structure and its typesData structure and its types
Data structure and its types
 
introduction to Data Structure and classification
 introduction to Data Structure and classification introduction to Data Structure and classification
introduction to Data Structure and classification
 
Data structures (introduction)
 Data structures (introduction) Data structures (introduction)
Data structures (introduction)
 
double linked list
double linked listdouble linked list
double linked list
 
Data structure and its types
Data structure and its typesData structure and its types
Data structure and its types
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure ppt
 
Data structure
Data structureData structure
Data structure
 
Data structure and its types.
Data structure and its types.Data structure and its types.
Data structure and its types.
 
L6 structure
L6 structureL6 structure
L6 structure
 
Introduction to data structure by anil dutt
Introduction to data structure by anil duttIntroduction to data structure by anil dutt
Introduction to data structure by anil dutt
 
Data structure
Data structureData structure
Data structure
 
Datastructureitstypes
DatastructureitstypesDatastructureitstypes
Datastructureitstypes
 
Introduction of data structure
Introduction of data structureIntroduction of data structure
Introduction of data structure
 
Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Data structure,abstraction,abstract data type,static and dynamic,time and spa...Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Data structure,abstraction,abstract data type,static and dynamic,time and spa...
 
Presentation on Data Structure
Presentation on Data StructurePresentation on Data Structure
Presentation on Data Structure
 
Data structure
 Data structure Data structure
Data structure
 
Lecture 1 and 2
Lecture 1 and 2Lecture 1 and 2
Lecture 1 and 2
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
 
DATA STRUCTURE
DATA STRUCTUREDATA STRUCTURE
DATA STRUCTURE
 

Viewers also liked

VPN
VPNVPN
Lines and planes in space
Lines and planes in spaceLines and planes in space
Lines and planes in space
Faizan Shabbir
 
Inner product spaces
Inner product spacesInner product spaces
Inner product spaces
gidc engineering college
 
ORTHOGONAL, ORTHONORMAL VECTOR, GRAM SCHMIDT PROCESS, ORTHOGONALLY DIAGONALI...
ORTHOGONAL, ORTHONORMAL  VECTOR, GRAM SCHMIDT PROCESS, ORTHOGONALLY DIAGONALI...ORTHOGONAL, ORTHONORMAL  VECTOR, GRAM SCHMIDT PROCESS, ORTHOGONALLY DIAGONALI...
ORTHOGONAL, ORTHONORMAL VECTOR, GRAM SCHMIDT PROCESS, ORTHOGONALLY DIAGONALI...
Smit Shah
 
Matrices And Application Of Matrices
Matrices And Application Of MatricesMatrices And Application Of Matrices
Matrices And Application Of Matrices
mailrenuka
 

Viewers also liked (8)

Baru matrices
Baru matricesBaru matrices
Baru matrices
 
Lec2
Lec2Lec2
Lec2
 
VPN
VPNVPN
VPN
 
Lines and planes in space
Lines and planes in spaceLines and planes in space
Lines and planes in space
 
Inner product spaces
Inner product spacesInner product spaces
Inner product spaces
 
ORTHOGONAL, ORTHONORMAL VECTOR, GRAM SCHMIDT PROCESS, ORTHOGONALLY DIAGONALI...
ORTHOGONAL, ORTHONORMAL  VECTOR, GRAM SCHMIDT PROCESS, ORTHOGONALLY DIAGONALI...ORTHOGONAL, ORTHONORMAL  VECTOR, GRAM SCHMIDT PROCESS, ORTHOGONALLY DIAGONALI...
ORTHOGONAL, ORTHONORMAL VECTOR, GRAM SCHMIDT PROCESS, ORTHOGONALLY DIAGONALI...
 
Application of matrices in real life
Application of matrices in real lifeApplication of matrices in real life
Application of matrices in real life
 
Matrices And Application Of Matrices
Matrices And Application Of MatricesMatrices And Application Of Matrices
Matrices And Application Of Matrices
 

Similar to Starting work with R

Data analytics with R
Data analytics with RData analytics with R
Data analytics with R
Dr. C.V. Suresh Babu
 
Unit 3
Unit 3Unit 3
An Intoduction to R
An Intoduction to RAn Intoduction to R
An Intoduction to R
Mahmoud Shiri Varamini
 
Lecture1_R.ppt
Lecture1_R.pptLecture1_R.ppt
Lecture1_R.ppt
ArchishaKhandareSS20
 
Lecture1_R.ppt
Lecture1_R.pptLecture1_R.ppt
Lecture1_R.ppt
vikassingh569137
 
Modeling in R Programming Language for Beginers.ppt
Modeling in R Programming Language for Beginers.pptModeling in R Programming Language for Beginers.ppt
Modeling in R Programming Language for Beginers.ppt
anshikagoel52
 
Best corporate-r-programming-training-in-mumbai
Best corporate-r-programming-training-in-mumbaiBest corporate-r-programming-training-in-mumbai
Best corporate-r-programming-training-in-mumbai
Unmesh Baile
 
R programming slides
R  programming slidesR  programming slides
R programming slides
Pankaj Saini
 
Datamining with R
Datamining with RDatamining with R
Datamining with R
Shitalkumar Sukhdeve
 
A short tutorial on r
A short tutorial on rA short tutorial on r
A short tutorial on r
Ashraf Uddin
 
Lecture_R.ppt
Lecture_R.pptLecture_R.ppt
Lecture_R.ppt
Abebe334138
 
Statistics lab 1
Statistics lab 1Statistics lab 1
Statistics lab 1
University of Salerno
 
Data analysis in R
Data analysis in RData analysis in R
Data analysis in R
Andrew Lowe
 
Lecture1_R.pdf
Lecture1_R.pdfLecture1_R.pdf
Lecture1_R.pdf
BusyBird2
 
Get started with R lang
Get started with R langGet started with R lang
Get started with R lang
senthil0809
 
Introduction to R.pptx
Introduction to R.pptxIntroduction to R.pptx
Introduction to R.pptx
karthikks82
 
R basics
R basicsR basics
R basics
Sagun Baijal
 
R Get Started I
R Get Started IR Get Started I
R Get Started I
Sankhya_Analytics
 

Similar to Starting work with R (20)

Data analytics with R
Data analytics with RData analytics with R
Data analytics with R
 
Unit 3
Unit 3Unit 3
Unit 3
 
An Intoduction to R
An Intoduction to RAn Intoduction to R
An Intoduction to R
 
Lecture1_R.ppt
Lecture1_R.pptLecture1_R.ppt
Lecture1_R.ppt
 
Lecture1_R.ppt
Lecture1_R.pptLecture1_R.ppt
Lecture1_R.ppt
 
Lecture1 r
Lecture1 rLecture1 r
Lecture1 r
 
Modeling in R Programming Language for Beginers.ppt
Modeling in R Programming Language for Beginers.pptModeling in R Programming Language for Beginers.ppt
Modeling in R Programming Language for Beginers.ppt
 
Best corporate-r-programming-training-in-mumbai
Best corporate-r-programming-training-in-mumbaiBest corporate-r-programming-training-in-mumbai
Best corporate-r-programming-training-in-mumbai
 
R programming slides
R  programming slidesR  programming slides
R programming slides
 
Datamining with R
Datamining with RDatamining with R
Datamining with R
 
A short tutorial on r
A short tutorial on rA short tutorial on r
A short tutorial on r
 
Lecture_R.ppt
Lecture_R.pptLecture_R.ppt
Lecture_R.ppt
 
Statistics lab 1
Statistics lab 1Statistics lab 1
Statistics lab 1
 
Introduction to R
Introduction to RIntroduction to R
Introduction to R
 
Data analysis in R
Data analysis in RData analysis in R
Data analysis in R
 
Lecture1_R.pdf
Lecture1_R.pdfLecture1_R.pdf
Lecture1_R.pdf
 
Get started with R lang
Get started with R langGet started with R lang
Get started with R lang
 
Introduction to R.pptx
Introduction to R.pptxIntroduction to R.pptx
Introduction to R.pptx
 
R basics
R basicsR basics
R basics
 
R Get Started I
R Get Started IR Get Started I
R Get Started I
 

More from Vladimir Bakhrushin

Decision-making on assessment of higher education institutions under uncertainty
Decision-making on assessment of higher education institutions under uncertaintyDecision-making on assessment of higher education institutions under uncertainty
Decision-making on assessment of higher education institutions under uncertainty
Vladimir Bakhrushin
 
Якими бути стандартам вищої освіти для докторів філософії
Якими бути стандартам вищої освіти для докторів філософіїЯкими бути стандартам вищої освіти для докторів філософії
Якими бути стандартам вищої освіти для докторів філософії
Vladimir Bakhrushin
 
Академічна автономія і трансформація української освіти
Академічна автономія і трансформація української освітиАкадемічна автономія і трансформація української освіти
Академічна автономія і трансформація української освіти
Vladimir Bakhrushin
 
Оптимізація в освіті і управлінні
Оптимізація в освіті і управлінні Оптимізація в освіті і управлінні
Оптимізація в освіті і управлінні
Vladimir Bakhrushin
 
Мій 2015
Мій 2015Мій 2015
Мій 2015
Vladimir Bakhrushin
 
Українські університети: Сучасні виклики та можливі відповіді
Українські університети: Сучасні виклики та можливі відповідіУкраїнські університети: Сучасні виклики та можливі відповіді
Українські університети: Сучасні виклики та можливі відповіді
Vladimir Bakhrushin
 
Два проекти закону україни
Два проекти закону україниДва проекти закону україни
Два проекти закону україни
Vladimir Bakhrushin
 
Окремі аспекти реформування освіти України з погляду системного підходу
Окремі аспекти реформування освіти України з погляду системного підходуОкремі аспекти реформування освіти України з погляду системного підходу
Окремі аспекти реформування освіти України з погляду системного підходу
Vladimir Bakhrushin
 
Decision-making in education based on multi-criteria ranking of alternatives
Decision-making in education based on multi-criteria ranking of alternativesDecision-making in education based on multi-criteria ranking of alternatives
Decision-making in education based on multi-criteria ranking of alternatives
Vladimir Bakhrushin
 
Деякі проблеми прийняття рішень в освіті
Деякі проблеми прийняття рішень в освітіДеякі проблеми прийняття рішень в освіті
Деякі проблеми прийняття рішень в освіті
Vladimir Bakhrushin
 
Закон про освіту
Закон про освітуЗакон про освіту
Закон про освіту
Vladimir Bakhrushin
 
Описова статистика в R
Описова статистика в RОписова статистика в R
Описова статистика в R
Vladimir Bakhrushin
 
Деякі графічні засоби R
Деякі графічні засоби RДеякі графічні засоби R
Деякі графічні засоби R
Vladimir Bakhrushin
 
Plot function in R
Plot function in RPlot function in R
Plot function in R
Vladimir Bakhrushin
 
Функція plot() в R
Функція plot() в RФункція plot() в R
Функція plot() в R
Vladimir Bakhrushin
 
Files,blocks and functions in R
Files,blocks and functions in RFiles,blocks and functions in R
Files,blocks and functions in R
Vladimir Bakhrushin
 
Робота з файлами даних в R, блоки виразів, цикли, функції
Робота з файлами даних в R, блоки виразів, цикли, функціїРобота з файлами даних в R, блоки виразів, цикли, функції
Робота з файлами даних в R, блоки виразів, цикли, функції
Vladimir Bakhrushin
 
Cluster analysis using k-means method in R
Cluster analysis using k-means method in RCluster analysis using k-means method in R
Cluster analysis using k-means method in R
Vladimir Bakhrushin
 
Нові застосування статистичних методів в прикладних дослідженнях
Нові застосування статистичних методів в прикладних дослідженняхНові застосування статистичних методів в прикладних дослідженнях
Нові застосування статистичних методів в прикладних дослідженнях
Vladimir Bakhrushin
 
Парадоксы голосования
Парадоксы голосованияПарадоксы голосования
Парадоксы голосования
Vladimir Bakhrushin
 

More from Vladimir Bakhrushin (20)

Decision-making on assessment of higher education institutions under uncertainty
Decision-making on assessment of higher education institutions under uncertaintyDecision-making on assessment of higher education institutions under uncertainty
Decision-making on assessment of higher education institutions under uncertainty
 
Якими бути стандартам вищої освіти для докторів філософії
Якими бути стандартам вищої освіти для докторів філософіїЯкими бути стандартам вищої освіти для докторів філософії
Якими бути стандартам вищої освіти для докторів філософії
 
Академічна автономія і трансформація української освіти
Академічна автономія і трансформація української освітиАкадемічна автономія і трансформація української освіти
Академічна автономія і трансформація української освіти
 
Оптимізація в освіті і управлінні
Оптимізація в освіті і управлінні Оптимізація в освіті і управлінні
Оптимізація в освіті і управлінні
 
Мій 2015
Мій 2015Мій 2015
Мій 2015
 
Українські університети: Сучасні виклики та можливі відповіді
Українські університети: Сучасні виклики та можливі відповідіУкраїнські університети: Сучасні виклики та можливі відповіді
Українські університети: Сучасні виклики та можливі відповіді
 
Два проекти закону україни
Два проекти закону україниДва проекти закону україни
Два проекти закону україни
 
Окремі аспекти реформування освіти України з погляду системного підходу
Окремі аспекти реформування освіти України з погляду системного підходуОкремі аспекти реформування освіти України з погляду системного підходу
Окремі аспекти реформування освіти України з погляду системного підходу
 
Decision-making in education based on multi-criteria ranking of alternatives
Decision-making in education based on multi-criteria ranking of alternativesDecision-making in education based on multi-criteria ranking of alternatives
Decision-making in education based on multi-criteria ranking of alternatives
 
Деякі проблеми прийняття рішень в освіті
Деякі проблеми прийняття рішень в освітіДеякі проблеми прийняття рішень в освіті
Деякі проблеми прийняття рішень в освіті
 
Закон про освіту
Закон про освітуЗакон про освіту
Закон про освіту
 
Описова статистика в R
Описова статистика в RОписова статистика в R
Описова статистика в R
 
Деякі графічні засоби R
Деякі графічні засоби RДеякі графічні засоби R
Деякі графічні засоби R
 
Plot function in R
Plot function in RPlot function in R
Plot function in R
 
Функція plot() в R
Функція plot() в RФункція plot() в R
Функція plot() в R
 
Files,blocks and functions in R
Files,blocks and functions in RFiles,blocks and functions in R
Files,blocks and functions in R
 
Робота з файлами даних в R, блоки виразів, цикли, функції
Робота з файлами даних в R, блоки виразів, цикли, функціїРобота з файлами даних в R, блоки виразів, цикли, функції
Робота з файлами даних в R, блоки виразів, цикли, функції
 
Cluster analysis using k-means method in R
Cluster analysis using k-means method in RCluster analysis using k-means method in R
Cluster analysis using k-means method in R
 
Нові застосування статистичних методів в прикладних дослідженнях
Нові застосування статистичних методів в прикладних дослідженняхНові застосування статистичних методів в прикладних дослідженнях
Нові застосування статистичних методів в прикладних дослідженнях
 
Парадоксы голосования
Парадоксы голосованияПарадоксы голосования
Парадоксы голосования
 

Recently uploaded

Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
DhatriParmar
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 

Recently uploaded (20)

Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 

Starting work with R

  • 1. GETTING STARTED WITH R: VARIABLES, VECTORS, MATRICES Vladimir E. Bakhrushin, Professor, D. Sc. Vladimir.Bakhrushin@gmail.com
  • 2. 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 (http://cran.r-project.org) project was created. It is a repository containing R system, libraries, materials and other related to R resources.
  • 4. 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".
  • 5. 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."
  • 6. 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).
  • 7. Creating vectors with function с()
  • 8. Creating vectors with function seq()
  • 9. Some functions for operating with vectors sort(x) var(x) mean(x) sum(x) Functions prod(x) max(x) min(x) length(x)
  • 10. 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().
  • 13. Accessing the elements of vectors and matrices
  • 14. Summation of vectors and matrixes elements
  • 15. Transformation of vectors and matrices elements
  • 16. Transformation of vectors and matrices elements
  • 17. 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.