R Programming - Tutorialspoint

3y ago
95 Views
10 Downloads
1.04 MB
72 Pages
Last View : 1m ago
Last Download : 2m ago
Upload by : Francisco Tran
Transcription

R ProgrammingAbout the TutorialR is a programming language and software environment for statistical analysis, graphicsrepresentation and reporting. R was created by Ross Ihaka and Robert Gentleman at theUniversity of Auckland, New Zealand, and is currently developed by the R DevelopmentCore Team.R is freely available under the GNU General Public License, and pre-compiled binaryversions are provided for various operating systems like Linux, Windows and Mac.This programming language was named R, based on the first letter of first name of thetwo R authors (Robert Gentleman and Ross Ihaka), and partly a play on the name of theBell Labs Language S.AudienceThis tutorial is designed for software programmers, statisticians and data miners who arelooking forward for developing statistical software using R programming. If you are tryingto understand the R programming language as a beginner, this tutorial will give youenough understanding on almost all the concepts of the language from where you can takeyourself to higher levels of expertise.PrerequisitesBefore proceeding with this tutorial, you should have a basic understanding of ComputerProgramming terminologies. A basic understanding of any of the programming languageswill help you in understanding the R programming concepts and move fast on the learningtrack.Copyright & Disclaimer Copyright 2016 by Tutorials Point (I) Pvt. Ltd.All the content and graphics published in this e-book are the property of Tutorials Point (I)Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republishany contents or a part of contents of this e-book in any manner without written consentof the publisher.We strive to update the contents of our website and tutorials as timely and as precisely aspossible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt.Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of ourwebsite or its contents including this tutorial. If you discover any errors on our website orin this tutorial, please notify us at contact@tutorialspoint.comi

R ProgrammingTable of ContentsAbout the Tutorial . iAudience . iPrerequisites . iCopyright & Disclaimer. iTable of Contents . ii1.R – OVERVIEW . 1Evolution of R . 1Features of R . 12.R – ENVIRONMENT SETUP . 3Try it Option Online . 3Local Environment Setup. 33.R – BASIC SYNTAX . 6R Command Prompt . 6R Script File . 6Comments . 74.R – DATA TYPES . 8Vectors . 10Lists . 10Matrices . 11Arrays. 11Factors . 12Data Frames . 125.R – VARIABLES . 14Variable Assignment . 14ii

R ProgrammingData Type of a Variable . 15Finding Variables . 15Deleting Variables . 166.R – OPERATORS . 18Types of Operators . 18Arithmetic Operators . 18Relational Operators . 20Logical Operators . 21Assignment Operators. 23Miscellaneous Operators . 247.R – DECISION MAKING. 26R - If Statement . 27R – If.Else Statement . 28The if.else if.else Statement . 29R – Switch Statement . 308.R – LOOPS. 33R - Repeat Loop . 34R - While Loop . 35R – For Loop . 36Loop Control Statements. 37R – Break Statement. 38R – Next Statement . 399.R – FUNCTION . 42Function Definition . 42Function Components . 42Built-in Function . 42iii

R ProgrammingUser-defined Function . 43Calling a Function . 43Lazy Evaluation of Function . 4610. R – STRINGS . 47Rules Applied in String Construction . 47String Manipulation . 4811. R – VECTORS. 53Vector Creation . 53Accessing Vector Elements . 55Vector Manipulation . 5512. R – LISTS . 59Creating a List. 59Naming List Elements . 60Accessing List Elements . 60Manipulating List Elements . 61Merging Lists . 62Converting List to Vector . 6313. R – MATRICES . 66Accessing Elements of a Matrix . 67Matrix Computations . 6814. R – ARRAYS . 71Naming Columns and Rows . 72Accessing Array Elements . 72Manipulating Array Elements . 73Calculations Across Array Elements . 74iv

R Programming15. R – FACTORS . 76Factors in Data Frame . 76Changing the Order of Levels . 77Generating Factor Levels . 7816. R – DATA FRAMES . 80Extract Data from Data Frame .

R Programming 10 R is a programming language and software environment for statistical analysis, graphics representation and reporting. R was created by Ross Ihaka and Robert Gentleman at the University of Auckland, New Zealand, and is currently developed by the R Development Core Team.

Related Documents:

tutorialspoint.com or google.com these are domain names. A domain name has two parts, TLD (Top Level Domain) and SLD (Second level domain), for example in tutorialspoint.com, tutorialspoint is second level domain of TLD .com, or you can say it's a subdomain of .com TLD. There are many top level domains available, like .com,

tutorialspoint.com or this tutorial may not be redistributed or reproduced in any way, shape, or form without the written permission of tutorialspoint.com. Failure to do so is a violation of copyright laws. This tutorial may contain inaccuracies or errors and tutorialspoint provides no guarantee regarding the

C Programming Tutorial. i C PROGRAMMING TUTORIAL Simply Easy Learning by tutorialspoint.com tutorialspoint.com .

tutorialspoint.com or this tutorial may not be redistributed or reproduced in any way, shape, or form without the written permission of tutorialspoint.com. Failure to do so is a violation of copyright laws. This tutorial may contain inaccuracies or errors and tutorialspoint provides no guarantee regarding the

tutorialspoint.com or this tutorial may not be redistributed or reproduced in any way, shape, or form without the written permission of tutorialspoint.com. Failure to do so is a violation of copyright laws. This tutorial may contain inaccuracies or errors and tutorialspoint provides no guarantee regarding the

tutorialspoint.com or this tutorial may not be redistributed or reproduced in any way, shape, or form without the written permission of tutorialspoint.com. Failure to do so is a violation of copyright laws. This tutorial may contain inaccuracies or errors and tutorialspoint provides no guarantee regarding the

tutorialspoint.com or this tutorial may not be redistributed or reproduced in any way, shape, or form without the written permission of tutorialspoint.com. Failure to do so is a violation of copyright laws. This tutorial may contain inaccuracies or errors and tutorialspoint provides no guarantee regarding the

All the content and graphics on this tutorial are the property of tutorialspoint.com. Any content from tutorialspoint.com or this tutorial may not be redistributed or reproduced in any way, shape, or form without the written permission of tutorialspoint.com. Failure to do so is a violation of copyright laws.