Page 200 - Data Science class 11
P. 200

PrograMMing

             with r


                                                                                    06










                      Learning outcome



                    6.1  Programming in R                   6.2  Basic Data Types
                    6.3  Basic Arithmetic Operations        6.4  Variables
                    6.5  Objects in R programming           6.6  Vectors
                    6.7  Multiple Elements Vector           6.8  List in R programming
                    6.9  Matrix                             6.10 Arrays
                    6.11 Data Frames



        In the previous chapter, you were introduced to the installation of RStudio. You have learnt about various components
        of the RStudio interface. In this chapter, you will learn in detail how to use the R language for Data Science applications.


        6.1 Programming in r

        You will learn through the code and its syntax. A program in R is made up of three things:
           • Variables
           • Comments
           • Keywords

        Variables are used to store the data, Comments are used to improve code readability, and Keywords are reserved
        words that hold a specific meaning to the compiler.
        To start with:
        To output numbers, just type the number (without quotes):

        Example

        5
        10.33
        758
        To output text in R, use single or double quotes:
        Example

        "Hello India!"
        ‘Hello India’



          198   Touchpad Data Science-XI
   195   196   197   198   199   200   201   202   203   204   205