Transcripts
1. Introduction: Welcome to the class R programming for data science and machine learning. If you look into the job market in 2020, you will find that most of the jobs are either in machine learning data science, in Python, RR, programming languages because by TA1 and are the, are the most popular programming languages used in most popular technologies in 2020, that is, data science and machine learning. And in this class, we will be learning about our programming from basics to aid was so that you can use these are programming concept if you want to defeat your data science or machine learning models further. So this class, we will start from Artist's Coalition and take you to the most advanced topics that as a vector manipulation, sorting of decision-making in NADH, and data manipulation and data analysis in R programming. So and with that, you can also create your own data visualization data graphs using our programming. So if you are interested in making a carrier in data science and machine learning and you want to learn R Programming, then this is the right class for you. So if you are interested and excited, Android Mao see you inside the class.
2. Why Learn R: Hello and welcome. So in this lecture we are going to learn why, why we should be learning R programming language. So to answer this question, we have to go through two things. First thing is what is our, and why we should learn up our region's behind learning programming. So let's get started with what is R? So R is the most popular language in the world of data science, data analytics, or aesthetics. So it is heavily used in analyzing data that is both structured and unstructured in nature. Nowadays we are getting huge amount of data. And that is called big data, which is mostly unstructured. And if you want to analyze those big data, you can easily do with the R programming. R, R. R with R. R is a programming language and software and woman for statistical analysis, graphics representation, and reporting. Our watch created by Ross yamaka and Robert Gentleman at the University of Auckland, New Zealand. And it's currently deployed up by our development core team. So R is invented by ross Yucca and Robert Gentleman. And that's why it's name is art because it's in winter name. Start with the art of Ross and Robert and they named it based on their name. And it is called programming from their regions to launch, our R is open source and freely available open source software you can plug and play. And if you want to contribute to the art that also you can do. And it's the GNU General Public License. So no need to pay anything you so freely our level. And that is the best region to use our programming. Cross split pump compatible. So whether you run the program on the Windows or Linux or Mac OS, doesn't matter. It will run seamlessly and it will give you the same result on any of these split one are a highly flexible and evolving, is flexible in nature. And it very much evolving and it is currently more than 2 million are much more than 2 million users start using our programming. Industries and domains. Widely used our programming. Like you name the industry and you'll find the uses of our programming that like financial domain, they use to detect the fraudulent transactions in the telecom domain. They are used the R Programming to profile for their subscriber profiling. In the biological domain, you'll find the competition or by logic to perform genome analysis to many, many domains they are using. And it's a huge community, as I told you, 2 million to just under a huge developer community. And odd is having more than 10 thousand last packages. And lacks of inbuilt functions cat into diverse need. So whether you want to perform a simple sum operation or you want to find the mean of some functions, some numbers. You want to do, some more graphical representations of your data. You can do easily with the R packages and input functions. And our packages are great for data manipulation, data visualization, machine learning, data science, and the statistical modelling, imputation and whole lot of other packages are available to play around with. R is great for visualization. And R packages like g, g plot two gives you great visualize yourself. So you can visualize data easily with the R programming. And many major companies like Facebook and Google they are eating are for their various needs. Od is equal to language. What is technical analysis and data science to R is widely used in data science, machine learning, data analyses, data mining, all those things. So odd Easter core to language, but all these things. And if you want to learn, if we want to go into THE data science and machine learning, a field, you start with the programming, because if you know the basics of our programming, you can easily go and launch our data science and machine learning concept and you can implement those concepts, those algorithms with our programming Eataly.
3. R Installation: Hello and welcome. So in this lecture, we are going to see art installation process. And at the end of this lecture, we will be able to run our programs inside our console. So let's get started to install R on our machine. We need to go to the website. Cr AN cran dot hyphen project. Dot ORG. Cran dot hyphen project or do RG, which is the official website up our programming. And you can see Comprehensive R Archive. When you come here, you may see a different piece if we are coming under different time after a few months. But moralists, you will see the Comprehensive R Archive Network here. And then here you will see download and install R. And here you will see the different operating system options that you can download R4. So here we are on the Windows machine. So I'll go with that download for Windows. If you are on Linux or if you're using Mac OS, you can go to the corresponding operating systems. So we need to click on the Download R for the respective Operating System. From my case, I'm clicking on the windows. And here you can select Install R4 first-time. Okay? And here we will go with the download R four dot or dot for Windows conduct but are not odd. Hyphen, poor dot O dot two hyphens. When dot EXE file will start downloading, it's 83.6 m v phi. And my internet is bit slow today, since morning. So taking some time, if you are on a high speed internet, it may take few minutes and dot EXE file will be downloaded. So just wait for it to get downloaded. And once it is done, we will start the star lesson process. So now the dot EXE file has been downloaded. So what we need to double-click on that and the prompt will come to install the art. So we just need to click on Yes to allow the admin access to the installation process. And once you do that, the SR Listen prompt will come like this. And here we need to select the language so you can select the language of yours and click on OK. Now we need to asymptote Thompson condition like GNU General Public License Agreement. So you have to read it and then we need to click on the Next. And now you can select a directory. I am keeping it in the c file by default directory and we need to click on Next. We're seeing already exists because it was already there. So I just click to install in anyway, click on is. And yet you can leave it as it is and click on Next. Click on Next. And here you can, if you want, you can select it to not to create the Start Menu folder, okay? If you want, I want to be created so I'll click on Next. And here you have to select, you just select the data decks, stops or shortcuts so that you can launch the are easily. Whenever you want to write program, you can just click on the text absorbed, got Anglican, gets started, reconnects and know the arm is getting installed on our system. It may take a few minutes. Highly, It will take gut goto three minutes. At most. Ceos, I know the R4 windows four dot, dot, dot, set of regard and it is saying it is finished. So just click on the Finish and odd is installed on your machine. To verify did odd is stored or not, you need to click on the Windows Start. And human just need to scroll down to check whether theta naught. See here, this is our for loop. And when you click, you click on the art folder, you will see that two opsins, r i dot r, three at D6 and 64. So if you are on Windows seven, Windows ten, and higher operating systems, you can go with the war would virgin. Otherwise you can go with the R36. Okay, so I'm under 64 bit machines, so I'll click on this and R will be lost. So this is the GUI and this is the R console. And here we can start writing our program. Suppose I'll do four plus five and it really gave me nine. Simple hello world program for art. So we need to write blamed. And then in the single quote Hello World, and it will print hello world. So see, you know, this is the simple Hello World program in R. So this is how the art programs can run in the R console. But for this course we are not want to use our console are RG way street. We are going to use our studio, which is an IDE for R. And that is more preferable and better option to proceed with the R programming. So in the next lecture, we will start downloading and installing RStudio seeming sector next lecture.
4. Installing and Exploring RStudio: In the previous lecture, we have downloaded and installed on our machine. And we have seen how to walk with roughly when the are console right here. But we are not going to proceed with this. So we are going to download RStudio for this course. And throughout this course we'll be using RStudio. So RStudio is an Integrated Development Environment IDE for R programming. And with that, we can do things easily and we can manage things in an organized manner and ID, they help a lot in programming. So we can code with ease and we can see the results with these. So next week we are going with the RStudio. So first thing first, we need to download the RStudio. So to download RStudio, we need to go to the studio.com. So this is the official website of RStudio. And when we reach RStudio website you'll see the very substance like product solutions, customers resources, and many things. And at the top you can see the downloader will not click on that. Before that, we'll just see what are the products of level at RStudio. So there is RStudio, the premium IDE for R, Then Irish to-do star. What is this sign is already there. And RStudio packages are also there. So we're going to use RStudio, the ID, and then we will be using R packages for various uses. When we explored that it assigns machine learning all those things, then we will be using R packages. Okay, so i'll just to do an R packages we are going to use. So please click on our studio. So I wish to do is an integrated development environment for our. It includes console syntax highlighting editor that supports direct code execution as well as bulls plot, plotting, history, debugging, and what? Place management. Okay, so all this things we can do with the asked told you we are going to use the latest release up RStudio one dot three. And there are two versions of RStudio of level that is honest-to-God, x-dot and RStudio's server. So we aren't going to use, the other students said, well, we're going to use RStudio on our next job, so we'll click on that. And when you see other storage extra, again, you'll see the two options, open source edition, which is basically a free thing, and RStudio Desktop Pro, which is what commercial use. And for this RStudio Desktop pro, we need to pay $995 Body. We're not going to use this commercial one. We are going to use for this course. Though, RStudio, fully open-source version, that is a GPL version three, free licensing. So I'll click on the download artists to do the extra. Click on that. And when you click on that, you'll come to the harsh to do download base. And here we can choose this free version and click on Download. And when you click on Download, it will take you to your respective Operating System. Was done so year Hal download RStudio for Windows. If you are on other operating system, you can click on that like o12, macOS, whatever operating system you have, you just select that file hand click on download. So I will download RStudio for windows and click on that. And artist studio dot EXE file will be downloading. It will start downloading here. So I'll read for that. So this artist studio dot EXE file has been downloaded, so I just need to double-click on it. So artist reduce setup wizard has started, so I just need to click on Next. Next. You just need to click on Next, next time it will be done not only to do anything extra and just click on Next, Next, Next hand. It will be done in couple of minutes. So the artist studio setup has been done. And just click on Finish. And RStudio has stark completely only Alesina zoologists. So Well, look like this. Here you'll see the opsin to write your script. And this is a console where we can see the results of those scripts. And then on this right top corner you can see the environment history. Whatever the command and script we are running those extreme, you can see then the connection and then tutorial. So if we want to learn about particular package or something, you can go here and learn about that. And then here you can see the files. So on the working directory files will be shown here. Then the plots when we use blogs and all graphs. And now if we run something landscape for plotting something as a graphical things, all those blocks and all will be sown here. The packages which we use in our script. Those packages will be available here. So all the packages that are installed will rezone here. And you can just select. And if we want to remove that backend, you can remove from here. And if you want to learn more about the package, you can click on this link and you can learn more about the packets. So here you can see the package name and then the sort description of the Bacchus and the origin of the Bacchus and then explore and then delete, remove the package option is there. And if you want to install a new package, you just need to click on install a new package, name your prosperous way and it will be downloaded. Okay, and then here there is a help ops and you want to learn about our artist studio. Audio. You want to go to the manuals are large to do mammals, you can go here and get the help on any topic, okay, then these things we have seen connexons and tutorials and all will be HIEO. And from here you, the three doors. You can see, when you click on this, you can select the working directory that you want to sit for your RStudio. So suppose selector, I parented 20 as a working directory. So I'll just select that. And then we need to click on this more opsin and Set as Working Directory opsin is dead, you just need to click on decks. So senior set w, w is the command to set our working directory. So senior set d column are printed 20. This tree has been working directory. So if you don't want to do from here, you can use this command to set the working directory, okay? And then here you can create a new folder, you can delete, you can rename. Although dropstones at our level here and here we can just write the scripts approach by plus five and this R1, you can select this line and you're gonna click on run and this screen print, this statement will be running and you will see the result here for then simply, you can, if you want to print something, print hello, RStudio and click Run, you'll see that there's LTL Hello, RStudio. Okay? And in the history you will be seeing all the commands that are being executed. Okay? So these are the things. And this file you can say we want to save this file, you can click on save, and it will be saved in your current working directory. So you can give any name first. And it will be saved data R5. Okay? Similarly, if you want to create a new file, you just need to click here and you'll see the artist's group if you want to click create artist script file or notebook or R markdown file, we will see what is R markdown file. We will be learning about this Agile. Okay? And then here, if you click, you can create a new project or new directory. You can go to the existing directory and here you can see the version control. Okay? So these are the various options of level. If you click on file again, you'll see the new file. Scrape. Mark down all those things you can see here. And gold plots that we have seen the same thing. Build, Debug profile pulls a noun. So we'll explore all these opsins when and where needed. And we'll explore all those things for now. This is the script RatingBar, Daniella, we'll see the result and here we can see the current working directory and blogs and all. If we use, you can see packages can be installed and our huge from here. And here you can see the history and all. Okay, so this is all about RStudio. And now we are ready to start with our programming with this artist studio IB. So from the next lecture onwards, we are going to learn our programmings. Or Stephen said the next lecture.
5. First R Program and Operators in R: Hello and welcome back. So in this lecture we are going to write are forced our script file or first our program, and we'll see some syntax of our programming. Okay? So first thing first, we need to create our file. So I'll act created in the previous lecture fostered out. I'll just close it. And we just need to click here. And we'll select artist script. Or you can, alternatively, you can use Control sipped can create a harsh script plane. And here, what I'll do, I'll try to save this by clicking here. You can put controllers and I'll give this name forced our program dot part. Okay? So dot-dot is the wild extends and programs. Ok, I'll just clipped. So I'll just click on save. So now first part programs script file is done. Now what I'll do, I'll just start with some variables. Suppose X, X is and variable here. And I want to assign it a value of seven or eight. So here we can assign a value using a less than sign and hyphal thus. So x. And when we use less than desk eight, it means that this object in our programming, everything is an object. So we can call as an variable, or we can call it as an object. As an object or variable. So x is an object and we are assigning it a value eight. How can we check that it is having no value eight now? So when you click on Run, you'll, you'll see and see here on the global environment and one-month heavier, you can see x values x. So x object is carrying an ALU, it. We can simply use the print command. And we can put x inside. And then when we run this, we'll get the value eight. Okay, we're getting the eight. So know what I'll do. I'll simply write a program to add two numbers. So I'll use x equal to eight. Why? So see what I did. I assigned it to x, nine to y, and then I have used another variable or object, GED. And I have assigned x plus y equal to jet. And what I did, I print Jedi are so we will get the X plus Y in jet. So jet will be getting x plus y, x plus eight plus 917. So we're getting value I just 17. Similarly, what else do? We can use string as well. I'll use my string and assign some string value to it. Suppose my anything, okay, so this is the string I'm assigning to myString value. So now the myString object will be carrying what my home, right? So what I'll do, I'll just try to print it. And I'll try to run this executed this line and hours executing this print statement. So we need to execute line by line, okay? And if we want to execute at once, you just need to click on the source. So click on Source and everything will be 17 for this print. And then my home it results for this string value. Okay? So this is the way I'll show you one more time. Suppose I am using x 910. And I mean you didn't print xcr. And if I run this, I'll get eight. So because this statement I have executed earlier, so I'm getting X4 eight. The new value, x equal to nine, x equal to ten is not executed at soar. To execute that, what I need to do, and it will run this line. And if I run this statement again, I'll get ten, right? See, if I run this whole source. What I will get first, I will get the value x plus y 17. Recall here, till here, X value is eight. But when we proceed in the program, x-value is reassigned to ten. And that's why we are getting the x value is ten here, okay? So the myString value is a string variable and X, Y, j, the other numbers, okay? And suppose something if you want to, suppose I don't want to use x equal to ten, I can come down by using casts. Ok, so now this statement will not be executed. So now if I run this whole program Hall scraped, what I will get, I will get x equal to eight, okay? And not get ten less than the CEO. Now I am getting x where Louis XVI, Louis 81. If not ten, if we remove these commenting, again, I will be getting ten. C x value is Covington. So if you want to comment on something you can use has and that the statement will be commented down. Similarly, we can perform all the mathematical operators on the variables. So suppose I want to use foreign to five, and we get 21 to 20. If I want to use 25 divided by five, I'll get five. So all these things we can do, we can perform all the mathematical operator C. Suppose I want to use 25 divided by two, I will get 12.5. So all these things we can do here, we can also use exponential things, as we'll suppose I want to use three, exponential, two, exponential two, we'll get nine, right? So then this C, a will be getting nine. Similarly, if I use 25 exponential 25, how much we get? Let's see. Okay, so this is the big value I should have. Use 25 exponential two will get 625, I guess. Yeah, 625. So all these mathematical operators we can, yeogiyo supports. If you want to use six exponential one, you'll still Get six, right? If you make two, will get 36. So all these mathematical operators and calculations we can use in our, as usual, okay, see we live, we can perform subtraction as well. 78 minus six will get 22. So we have seen like Edison subtract x1 multiplication exponential. And we have spacial operator that is more or less also. So suppose I use 45 and model plus we'll use two times. So 45 modulus, suppose I use five. So 45 modulus phi will give 0, right? Yeah. And if I used 45 modulus four, I'll get one C. So and if I use 25, more or less, three, I'll get four, sorry, one. Okay? So modulus will keep that remainder. So three divided by 25 divided by three will give us 13 into it, 24 and then we'll get the one as a reminder. Okay, so when we performed division, that reminder will be given as a modulus result. So these are the operators we have seen in the sense of Jackson multiplication exponential, and then the modulus.
6. Data Types in R: Hello and welcome back. So in this lecture we are going to learn about data types in R programming. So unlike in other programming languages like Java or C, or C plus plus, where we declared a variable, we declare the variable without data type, right? Suppose we want to use an integer, a number value one will declare that int x. Right? Now, float y. I'll character x, right? String. Why string? A string like that, right? But in our programming, we don't declare variables with datatype, right? Suppose alpha I find here, I have assigned x are ten, right? I have assigned ten to x. So this object is assigned the value obtained. So the data type of this object will become data type, data-type of this number ten, right? So this variable of this, suppose this is ten as an integer number. So this object data type will become number. If I assign x equal to some string, this will become the character string variable. So we don't decide upfront, whatever we assign to the variable or object, that object will become adept at type. So it's more or less like our dynamical mirror type rate. So we don't put the data type up front. It will be decided what kind of value going to that object. And that object will become that type of value of an object, right? So let me create another file where we'll be seeing the datatype. So let me clear this as well. So there are basically six types of R objects, and they are like vectors. Vectors, then lists. And then we have, that is and then we have matrices. And then we have factors. We have factors and then, sorry, okay, and then we have dataframes. Okay? So these are the six our object types.NET we have in our programming. So let me explain these data types one-by-one on object types one by one. Okay? So the first thing, we'll see the vector. So vector object is the simplest object in R programming. And suppose it has six datatypes. So we'll see, suppose I'll use. X equals x. What we like it. And support that if I want to know what this x, what they can do, right? Canoes blamed, and then I can use glass, sorry, inside the print x. Okay? And if I run this, I'm getting plus xs logical. So this is the axis logical data type. Ok? Similarly, we have numeric. Suppose if I assign X equal to 90, and let me just copy this. And I'll put y here. And if I run the whole source seal, the class of Y is suing numeric, right? So now, see we are not assigning or we're not declaring the datatype of y. Whatever value we are assigning based on that, the variables are, the datatype is being decided. Okay? So here we have given a logical, so it is logical, and here we have given numeric, so it is noetic. Next thing is integer, right? Suppose I'm 90.9. So what would be the C? It didn't nomadic right? Now, the next thing is called seen integer. So suppose I use r, t, and I'll assign somewhere else, supports 34 L. Okay? And then I'll use print plus, plus sub k. So when I use print class up t, What delegate? Cme, I'm getting nomadic. Sorry, I'm getting no class up. This integer is an integer data type, right? Similarly, we have complex suppose and declared a complex number, three plus five. Right? And when I put class and what we like it, see the Class F, i is complex, so this V, each complex number to plus phi by similar list of balls and assigned C as our ALU program. And if I bring the glass up, see what it will be here to be character right? Now I'm getting the class up, sees character. Next thing is support the values and character to draw and, and use Java. And if I print class and you want to be, it would be. Let's see. Okay. Next thing is the sewed. Our objects are called vectors. Okay? So these are the vectors types like glass, I'm WS class up C is character class of v's complex number a plus up D is integer class up, why is numeric? And plus up x is logical. So these are the data types are object types, you can say in our programming. So let me save this file as later types. In the next lecture, we will see how we can create our vector, okay?
7. Creating Vectors in R: So hello and welcome back. So in the previous lecture we have seen the different data types in R programming. In this lecture, we are going to learn about vectors, how we can create a vector W0. Most people element, more than one elemental control script can. I'll create a new file. And in this we are going to write the artist, therefore creating a vector with multiple element, more than one element. Ok, so what I'll do, I'll try to deviate and rector hockey. So suppose I wanted to create a vector quantity and I want to assign it to a multiple of l. So in our programming, when we want to create a recto with multiple element, we have to use a function called C function, right? So this c function will allow us to create eigenvector with multiple elements. Okay? So we'll use C and open and close bracket. And then inside that we can write our elements. Suppose I want to create countries names, of course, L port, Australia, comma retain. Okay. South Africa. Support these other elements, some connecting enzyme disruptor. Okay, so we can use the function OOP, Create and vector with multiple elements. Right? Now, I just huge print and I've put g. So this will print the values inside the director. So let me run this. Let me save this file. And I'll save this freelancer force vector dot card. Okay? And all these files will be our level inside this current working directory that we have zip and I'll act as these files. So already you can download and you can walk on that. Okay, so liquid on this source while See, ya know, we let me clear this console and run and run it again. So see here now we are getting the value for t vector as Australia, Britain, sort of McCandless, Yeah, right? So this is and vector with elements inside it. We can, we have seen how, Sorry, we have seen how we can create a vector with single element. And it will give us the following day rate. It will give us in the audit. So this way we can create and vector then the object with a single element and we can use C function to create and vector with multiple element. And suppose if a huge print glass of G, what will be the output? Can now guess, let's see. Character c. These are connectors, so it is giving us the t vector S character. Suppose if I change this D, o, sorry, let me first printed this class of D. So the class uppercase character layer. Now what the LU and just change it 200. Okay? And I'll try to try to run this. And then I'll try to run this last statement. See, ya know, we are getting the glass up. D has a nomadic, right? If I change one, grantee, 3779. And if I run this source for L, what we get, we will get the 12 to 3779 and the class of G is now changed to numeric. So whatever data you are going to use based on that data type of the vector will be decided knocked up front like C or Java programming. Okay? So this is the difference between C, Java and heart rate. So whatever you use based on that, it will be decided.
8. Sequence in R: In this lecture, we are going to learn about sequence. We are going to learn about the sequence bunks on him. So what do we do with the sequence function that we'll see? But before that, let me tell you one more important thing that I have forgotten to include in the previous lecture, and that is, suppose I am creating a vector and using C function. And if like here, I've created a function Eugene Wally numeric values. So the class of this will be numerically because all the elements are numeric. What if I'll give one character and then I'll give numeric, and then I'll give a logical, and then I'll give an integer. And if I run this, and if I print this vector c, you know, hello 67 through everything into a quotation. Why? Because if we, if we create a vector u in c function and one of the element is of character, all other elements, whether is numeric integer onto logical, it will be converted to string. So if I, let me just copy this. And if I put class of wave, it will be coming as a character. So all other elements will be converted to the character if any one element is character, all other numeric God, logical, integer, all other elements will be converted to the character and the class of debt vector will be character. So remember this, if all numeric, it will be numeric if all integer class will be integer, but if it is mixed of integer and character, the integer will be converted to the character. If any one, any element is character, everything will be converted to the character. Okay, so that is to clarify. The next thing is I'll create a new script file. I don't know why this is not going up. Whether it's something here. Okay. That is some kind of eras and on all y. So now we are going to learn about the sequence. So in R we can create a sequence of numbers like suppose I want to create 12. I want to print numbers one to ten. I can do that in two steps. In two ways. I can do that in two steps, but in two ways I can do that. I can use a colon operator or I can use sequence function. So first thing, what I'll do, I'll try to create a sequence of numbers. And I'll assign me to some value. Suppose I want to get the eta sequence. Suppose I will say it, See, I'm creating a variable c that will be having value. I want to assign it a value one to seven. R12 pain are one to a 100. So how I can do that? One colon 100. If I do 100, and if I run it, what it will do, it will deviate sequence from one to a 100. Let me see. C. 100 numbers has been generators, so it will create a sequence of numbers from one to a 100. So let me for the console on the right. So now it will be easy to understand and write the accordion and output will be here. And let me, okay. So now, so what we need to do to create any sequence, we need to give the first number from where we want to start. And then we have to give the ending number. Suppose if I give ten and if I run this two, it will create a sequence from one to n. So if we want to create a sequence, you can use this colon operator and you can get a sequence of number. Suppose I want to create numbers from one to 20. I want to create to, to 20. How can we do that? If I run this, what we will get to see, we will get 2468 up to 20. So each and every element, a sequence numbers like one will be multiplied by 22 will be multiplied by two. Plague that we'll get, right? Similarly, I can create a sequence of, suppose I want to create a sequence from 2.5 to four. I can do that. If I print f c Here, I am getting 2.53.5 because next one will be formally, so it will print the sequence from 0.5 to four. And if I use here, what could we be giving the echo 0.53.5 up to 39.5, right? The same way. Suppose I want to create a sequence from two colon, 20 minus one. And if I print d, can you guess what will be the answer? Let's see. Now we are getting one to 19. Why it is coming one to nine, because the one will be minus from this 120. So it will actually generating number. From one is to 190 minus 1120 minus 119. So the both will give us the same result, right? Okay? The next thing is, we can do it in a different way as well. Cleared out boot. I can use sorry. I can use a variable a, I can assign a value eight. And then what I can do, I can, I want to generate numbers from one to eight. So I can, if I run this to what I will get, I will get a sequence of numbers from one to eight, right? So this way also we can do, we can assign now value. It puts a variable or object e, and then we can put one is to it, instead of punished to it, we can put one is two a. And this will also give us the same two delta t 128 numbers has been generated. I can put one minus a as well and see what will the result 0 to seven because it will one minus1, 08 minus 17 to 0 to seven sequence will be generated. If I put a minus one into bracket. And if I try to run this, now I'll get one to seven because this will be executed first, okay? So it will be seven and the one will be one because we are not subtracting this one from here because it is in the bracket. In an, in art, the bracket will be given the higher preference. So this will execute first. So one is to seven. It will generate numbers from one to seven. Apart from this, we can use sequence to create a sequence of numbers. So suppose I'll give, if I write as d q and I'll give one comma, one comma five. What result I'll get? I'll get the sequence of numbers from one to five, right? Similarly, if I give a sequence of suppose nine, and what result I'll get, I'll get a sequence of numbers from one to nine. Here, I am giving one-to-five means from one to five. And yet if I'm not given the first digit, what it will take, it will generate from one to nine by default, okay? That, that is the default nature of sequence. Okay? Next thing is we can use this function in a different way as well. I can use from a, suppose 82 equal to 32. And if I run it, what it will do, it will generate numbers from eight to 32 to 32, okay? Similarly, we can also use sequence as I can keep the front number. Then I can give that number, suppose eight, and then I can give two. So what this two will come? It will, this is known as the step. So let me write it here. Sequence two comma, suppose 12. Step two. So this argument is step. So let me run this first and then I'll explain, CEO, what we are getting. We are getting 24681012, what it is doing, Institute of creating a sequence of 234 up to 12. What it is doing, it is creating, it is giving us the adding two to four. There is a gap up to right, because we have given the step value as two. So two plus 244 plus 26, six plus 28, there will be difference up to between these two sequences. So that is what the user see. Step augment. This is the step out when the system step argument, right? We can also see another example. Suppose I want to create a sequence of ten from ten to 25. And I want to increase the sequence by wine 75. So let me run this. Sorry. C, l, what we are getting, we are getting that sequence of numbers are getting started from ten because you have given ten and it is going till 25. And what it is doing, it is adding 0.75 in the each values or ten, it will start then it will add 0.75. Then in 10.75, what it will do, it will add another 0.75. So learn 0.512.25. So this byte, 75 minute, it will increase the value by 0.75. Suppose if I do this way, three, what it will do, it will add like 101316192225. If I increase this by value to five, what it will do, it will 10-15, 20-25, like this. Ok, so this way we can generate the sequence. There is another thing that is called length. So suppose I want to create numbers from 25 to 50. And I want to give length equal to six. What it will do? See, yeah, it is giving us starting from the 25, then 630, then 354045, and then 50. So it will generate sequence of six numbers between 25 and if I make it, now suppose, then what it will do. It will generate numbers 2527. So what it will do between 2550, it will generate ten numbers with equal like 25273030 points, something like that, okay? If I gave it a 100, it will generate hundreds of sequences, right? See you? If I give it to one, what it will do it only one number between 2550. If I give two, it will generate two numbers, D5 and 50. If I give three, it will when divided by three, C, 2537.550. Ok? Like this. So it will try to generate three sequences between 2550.
9. Replicate Function: In this lecture, we are going to learn about Replicate function. So what Replicate function will do? So we'll use the REP, REP, replicate and when we want to replicate some things. So let me show you with an example. So suppose I want to create a sequence where I want to repeat five times. I'll use rep function and I'll give five that I want to repeat. And here I'll give times, so I'll use times eight. So what this Replicate function will do, it will repeat 58 times. So we saw you see five-by-five, eight times. Okay? So this Replicate function will replicate the same number. Replicate means repeat it politically, 58 times. Similarly, we can use character says, well, suppose I'll give ds and then I'll specify times equal to three, or it will print three VS TS, ds, ds. It will create a sequence of bs, ds, ds three times. Okay? So remember this, whatever we are giving here, it will be depleted by number of times, okay? In the same way we can use, we can pass them. Some object to the application function. Suppose I want to, I have created so far Replicate function. I want to create a valuable are where I want to generate sequence from three to suppose six. So what is this 32326 will do? If I print out it will be connected three, 4-5-6 rate. Suppose I use a Replicate function here, and what I'll do, I'll pass this on to replicate. And here I'll give times twice. So what it will do this will repeat this sequence from three to six twice. Okay? So if we run this, what it will give, it will get 3456 and then again, three to 562 times. If I make it three, This sequence will be repeated three times. So 3456, again 3456, and again 3456. So number of times it will be repeated, the whole sequence will be repeated that many times, right? In the same way we have, sorry, we have another argument here in the replication function. That is, suppose I'll use our same object are, and I want to apply each to it. If I apply each year, I have applied times equal to three. Now I'm applying each equal to two also what it will do, let's see. Suppose I'll run this. Say you know, what it is doing. It is that each element from two to six will be repeated twice, and then it will go to the next number. Months means three, twice 33, then it will work for four, then 551066. So here 33445566. So each element will be depleted and then it will proceed to the next element. And earlier in times what each element will be repeated. And here each element will be repeated. And then it will go to the next element. And here the whole sequence was repeated, 3456, then 3456 again, and yet 3-3. Then pour for, suppose I put it three, what it will do, it will each element will really projectory 3.3.3, then 444, then 555666. So this is the difference between times and each replicate functional. In the Replicate function there are two arguments times and each time we'll repeat the entire sequence data many times. And each will, each element will be repeated for this many times. And then the sequence will be created like 333444, like this.
10. Accessing Vector Elements: Hello and welcome back. So in this lecture we are going to learn about existing vector elements. So we have seen how we can create and vector in our null or alkyne heat and vector handle retry to exist that any went off rectus. We'll see how we can X is the vector elements in odd. So for that, I need to create a file handle, gave it a name. It says req dot. Ok. So now what I'll do, I'll create an array with a name, month and for the months like January, February, march up there like that. Okay, so I'll use the c function and I'll try to store the values Jan. So what I'm doing here, I'm creating and vet down and I'm storing that rectangle. Object. Month, okay? And how much storing the values january fad money up to, okay. Now we have created and recto how we will access the elements of the vector. So for that, let me clear the console here so that we can see that. So if I run this and if I run month January to December, okay, so now what if I want to x's knob at Braille? August or September like that. Okay, so for that, what we need to do, I can create I can create another vector support month two. And for this, what I do, and it was the capital of bracket and now you just see function. And inside the c function I'll keep the index for the, suppose this January 1234, elegant for gama, suppose seven, comma nine. Okay? So I'm, I wanted to exist a month for 79 and e phi print month two. So if I run this tool, what do we get c? Now I'm getting as July and September because the index is four. And then 567 for July and for September eighth, nine. So this way we can call our x-dot elements of vector function. Okay? So vector object we can access legs would be if we want to access a particular element. You can do that if I change it to three. And phi. And if I run this wish statements, what we get to see, yeah, we'll get march and then non-white and amaze me. So like this, we can access the vector elements. We can also X is the vector elements using logical using logical indexing. So how to react? So suppose I'll create another object, months three and supported up which month I wanted to access a month. And the capital bracket and inside the c function, what I'll do, first I'll give support through and then I'll give false. And then I'll get false. Then I'll give true. So suppose I'm passing this true, false, false, true. And if so, sorry, print month three. What will happen? Let me run this and see the result. What we are getting, we are getting Jan. The first month is Jan true, so it is printing here. Then the next false, false. So the February, March will be false, wins it will not be, we're not accessing the federal body and marched, right? So these two values will not be there to February, March is not printed here. Then for the fourth one is true. So we had a getting to four. And then the desktop element we have not given. So it is coming as of May, August, and September. It is at the printing. So suppose it is again, doing the same fight on this. Again, a mayor gusts up the MN and the somewhere. So it is repeating the thing. Okay? Next thing is what we can do. We can use negative indexing. So suppose I'll create another object, month for and what I'll do, what will assign for the month for alcohol month. And and you see function and I'll give minus2 minus five. So what this will do, brent? And if I run this two, what will happen? See, I'm getting Jan, March and then made an arc that's February and May not printed because minus two means the second indexing minus2 that each February, February, Lord be, we don't want to access minus 2n minus phi means the second month and the month we don't want to access an except that everything else will be printed. Ok. So February and May will not reprinted. See here, February and May not printed, except all others are printed. Minus 12, then the somebody will not be printed as well. So now the longer the somebody, somebody's not there. So if you want to access elements and if we want to leave some elements, you can use dot minus for that index and it will not be brain dead.
11. Vector Manipulation in R: Hello and welcome back. So in this lecture we are going to learn about vector manipulation. So we'll see how we can form a reason within the vector elements. How we can add two vectors, how we can subtract two vectors, how we can perform the region within Twitter. And we'll see how we can do multiplication of the vectors. So let's get started. So I'll create an R script file and I'll give it a name. Manipulation. Okay, so let me clear the console here so that we can see correctly. Okay, so first thing first, what I'll do, I'll perform automatic office and within two with two vector so forth. Thing for Steve, what we'll do, we'll click too weak to swell, did support the vector F1. And solving for clear director. I'll create a vector F1. What I'll do unless some values supports 127895 something. Okay, so I'll create one vector F1, and I will copy and paste. And I'll create another vector, F2. And I'll give some to 83020. Okay? Okay. So now we have two vectors, F1 and F2. I wanted to perform addition. Okay? So what I'll do, I'll create another vector, another object a. And what I'll do, I'll assign F1, sorry, F1 plus F2. So what I'm doing here, I'm adding these two vectors, F1 and F2 and assigning it to object a. Okay, so now what I'll do, I'll print a. So let me run this. See you know, what I am getting. I am getting the result 2424, weight 12 plus 212 flushed element of these two vectors will be added, 12 plus 214, then 78 plus 819 plus 3125 plus 2530. So this way we can perform addition. Suppose I want to perform. So what I'll do is just copy this. I will return at the day. Yes. And I'll print the S and L here and what I do, F1, F2. So F1, F2, if I do or tell good SCM getting 107060 and minus 30, widen 12 minus 21078 minus 87090 minus 3065, minus 2520. So this way we can perform subtraction in the same way. If yours multiplication, I'll create over M And what I Lou F1 into F2 and I'll print L. And if I run this or delegate will get dwell when to do 2478 into 8 six twenty four, ninety into 302705 into 25.51. Similarly, we can perform di region. So suppose I create a vector t and what I'll do F1, F2. And I'll print deal. And if I run this or delegate, CEO, 12 by two, well-read, where do 678 divided by 9.79.8027 graded weight 25 is 0.2. Ok? So this way we can, but for a decent subtraction, multiplication and division. So let me write here, this is multi application. And then this is the region. So this way we can perform addition, subtraction, multiplication, and division on the vectors. And this is called vector manipulation.
12. Vector Elements Recycling: Hello and welcome back. So in this lecture, I'm going to tell you something that I have not told you. I'm not taught you in the previous lecture. And that is very unique question that you might have asked If it is a physical or offline class. And you must have coming to, this question, might have coming to your minus1. So suppose I have two vectors, F1 and F2. And F1 is having four elements and F2 is, I've been wanting to elements. And what if I will add these two vectors? Suppose I'll perform addition on these two F1 plus F2. So your four elements and two elements only. So how it will do. So in our, if we tried to perform F1 plus F2, if we try to add two unequal vectors, then the second vector, which is of length, it means the sorter vector will be, elements will be recycled to make it the length of the first vector. So in this case, what will happen? Vector will become like this. Internally where F2 will be like two comma, comma two, comma eight. So f two will become something like this, okay? It two, it will be repeated till it will make the number of elements in the F1. So there are four elements, so it will repeat to it, to it. So this will become something like this, and then it will perform the automatic operation. Let me run this. Hence, when you're done with that, you'll get a better idea. Let me clear this and run this. See here now the result, age 148690 to tackling how to plus four to plus two, sorry, 12 plus 214. And then 78 plus eight, 86, and then 90 plus two. Because the two, it will be repeated. So 92925 plus 813. So this will become like this. If I add one more element here, suppose 80. And if I run this, what will happen? Let us see, see here we're getting an error here. Longer object length is not a mildly off soccer object length. It means now see yet to this element is F1. F2 is having two elements. Two elements. And F1 is having F18 every five elements, right? And really getting it at that. The second, the first element to this is having two elements and this is five. So five is not a multiplied by love. To write. Naturally we are getting. So because two, if you divide five by two, you will get a remainder one. In this case, this reputation will not walk. But if I add one more element, suppose seven. And if I try to run this, this will walk the style c. And now we are getting the result because now the number up element is six years. And second one is 22266 is a multiple of two. So the first L W longer elements, longer vectors would have the as many numbers. Number of elements should be multiple updates sorta inversely to six. So six is a multiple of two. So this sum, this multiplication of the Vigenere addition you can perform, but if it is five, then two will not be the five will not be the multiple of two, and it will throw an error like this. Ok, so I hope you got it. Similarly, if you want to perform the multiplication that also you can do the multiplication division everything will be done so that elements recycling will happen only if the softer the elements in the longer vector, either multiple up the elements in the sorta rector. So longer vectors, number of elements are widow. Multiple, softer elements, okay, no more abstract elements. Ok. I hope it is clear for you.
13. Sorting Vector Elements: Hello and welcome back. So in this lecture, we are going to learn about who vector sorting. So let's see how we can solve vectors in. Okay, so what we're going to learn, we had one neutron sorting, right? Okay, so for this we have function calls sort. So we are going to use the sort function. So first thing, first clip when could lead and rector wreck. And for these salad, I'll give some number 3498 to the two Y 43, some random numbers. Okay? And suppose I want booths or this vector elements. So what I can do, I can simply create another object sort prereq, what I'll call the sort function. And I'll box this. What is that vector to the sort function and what this sort function will do. It will start this vector and then Waterloo, I'll just simply print sorted. So yet I'm printing the sorted recto, and this is the original recto. And I'm passing this vector to the sort function, and then I'm printing the start date vector value. Let's run this and see that it's definitely clear this terminal and run the decane. See, ya know, we're getting us are correct. So 34, nine, twenty seven, thirty four, thirty six, forty eight. So it is sorted in increasing order. So by default it will sort in increasing order. So the lowest value elements we look washed and then it will keep on increasing. Ok? So this way we can sort and vector. What if I want to sort this? But I've won in a decreasing order. So for debt, or they can do, I can use the same sort function. And here what I will do, I will just keep decreasing, decreasing. It's a logical thing, and here I'll give two. So decreasing, I'll keep drawback because by default it is false. And it will do that. Increasing order rate, ascending order. By default, it will sort in ascending order. So what I'll do, I'll do the cleansing contour. True means it will, sorry, the vector into decreasing order. So let's run this and see, see you know, this sorting in decreasing order 98 first, then 4636342794. So this way we can sort in decreasing order. Next thing is we are going to see starting off character, record character. So that also we can do suppose I have a vector which is having some values like ROM for some random things and read country. Okay? Anything in a vector form. Ok, so this is the o vector. It is having values in character. And suppose I want to sort this and I wanted to store the sorted vector, random vector function sort. And I will pass this vector one, vector two, the sort function. And if I run these two lines, what, what do you like it? Let me bring to this. Print two. So if I run this line, what would let you delegate? Blue, then concrete, then form, then drown, dendrite. Why it is so because b and then c, then f, n, r. Okay, so it will be in the alphabetical order. And what I want to sort in. But he also ordered, I can give you decreasing or do Drew and no see that deserved it when we started our first R, then f, then C and then B. So the Mozart poverty, God, or it will be. So this way we can sort the vector spot character and the number, OK.
14. Decision Making in R: Hello and welcome back. So in this lecture we are going to learn about decision-making. And so in odd, like other programming languages, if we have the if statement, we have if L and we have switch statement. With that, we can perform decision-making. If statement means if something is true, then the following statement will be executed. And if else, if something is true, and if, if we are giving a condition, if that condition is not fulfilled, then the if statement will be executed. Switch will see how the variable will be tested for a quality of established of Fellows. So we'll see if else. And then let's see the suite. So let me create artist script file here. And I'll give this a name. Decision-making dot. Save it. Let me clear that console so that we can see that it's, so first what we'll see, we'll see it. Sorry. First will see step. Okay. So first we will see if statement. And if it's, if it's stormwater, it consists, consists the Boolean expression and falling statement. So if the Boolean expression is true, then the following statement will be executed. So suppose Waterloo here, I'll create an object a, and I'll assign value 67. You can write anything, okay? And what I'll do, I'll write if statement, if ie less than 70, then what I'll do, I'll try to print a is less than 17, okay? Suppose this is the thing I want to perform. So if I run this, what will get? See that result I am getting is less than 70. Suppose if I change this value, 75, sorry, 75. And if I tried to run this, what will happen? I will not get any output because E is 75. And if I go inside this if statement, it will be sowing. A less than 70 is greater than 70, so it will not enter into this statement. It will not fulfill dot if condition and this statement are largely framed it, right? So this is called if statement, right? Similarly, I can write like a dot. And so the Alpert is integer, and then I'll pass a and a light is integer. So let me run this c here. Because is a numeric here. And what I'm testing yet, if is an integer, then I need to print a is an integer, right? If I make this an integer, k1 equal to 75 L, and if I run this c, Now a is an integer, it will be printing. So this way, if this condition is fulfilled, true, it will print this subsequent statement. Okay? Similarly, we can put an else statement here. If each integer then it will print this. I can print thing tight like a nomadic. So if I run this, if I change this to numeric, and if I run this again, what we'll get will get 0s nomadic. Let me try. If I pick a and if I run this, this is an empty jar. I need to check the statement here. Because this condition as getting true, so it is printing is. Nomadic rate is numeric. A's nomadic. And this statement is not, it is not going to the else part. So this way we can put if now we'll see switch statement, okay. See switch statement. So let's switch statement will do suppose I have a vector D And I'll use switch. And then what I'll do, I'll huge support for gama one. And I'll give 23. Okay? And then I'll close the switch. Di, what value we will get, let's see. And you get four because I'm passing for. So what switch statement will do? It will go to the fourth value, and it will bend that 1201234, so it will print four. Suppose I am writing here something else. Hello. So this hello will be printed. Okay? Let me show you this printing hello, right? And suppose that if we're doing one or two, it will be printing two. So it will go to the corresponding please. Ok. So far two, it will go to the one-to-two. It'll print this. For three, it will go to the handle for 45, it will print five. Let me see if I, so what did we do? A switch statement allows the valuable to be distinct for equality against the list of L. So these are the list of values. And for them, indexing is 12345. Whatever index you will give you, that index value will be printed. Suppose I'll give three. So the index value three will be printed. Three means 1233 will represent it. If I give four, then hello will be printed c. So this way we can use a switch statement in hot.
15. Loop Control using repeat and while loop: Hello and welcome back. So in this lecture we are going to learn about loop statement. In what is a loop? A loop is a function. You can say a loop. With a loop, we can execute a statement or group of statements mightily by times. So when we put loop, when we put a statement inside the loop, will be executed multiple times until that condition is satisfied, right? Until unless it is satisfying the condition will keep on looping the same statement again and again. So a loop statement allows us to statement a group, a group of statements multiple times. And there are three types of three types up loop statement in. The first one is the second one needs while loop. And then we have the very popular Guadalupe. So what I'll do, I'll start with a repeat loop crossed. So let us see what is repeat loop in R. So suppose we have a recto, which is having the values supports us. Okay? Like this. So it is, I'll save it later. So we have a vector which is having values India US and retain. And suppose I am taking another red able. Suppose I'll give it a name count. And I'm keeping it like support for gold equal to four. And then what I do liquid feed function here. And I want to print the vector particular number uptime, okay? So what I'll do, if count is less than ten, then of what I wanted to do, I want to print. Ok. So if I run this, what will happen? It will keep on printing this because count is for, and what can we say? If count is less than ten, so this will always be less than ten, right? So what I'll do, I'll use here count, count plus one. So up each address, an island, count value one. Okay, now let me stop this. And let me run this code again. Now see what happen. It does print 1-2-3, 4-5-6 times y is extended. First time it will come to four. So it will print. Then if your login, so current will become five. Then again it would have been four. Then 54678 up to nine, then asked to manage the conflict becomes ten. It's been luck for it. So it will print 45. It will print for 456789. So and astronauts confident become ten. It will come out of this loop. So this is the huge up. Okay? So this way we can use the repeat loop, okay? In the same way, we try to use the while loop. So while counter is less than, suppose, while count is less than eight, what I'll do print C counties for and what I am giving you count less than eight, then it will print vec and it will increase the counter by one. So if we run this, we get India-U.S. poor damn state because it will print four for preparing for five, equilibrium for six, it will print 47 and S1 current will become eight. It will come out of this while loop. Okay? So this way we can use the while loop.
16. For loop and next statement: In this lecture, we are going to learn about fought in, up. So suppose I'm creating a vector d, vector d, which will be containing something like two to 20. Okay? Suppose, if I bring t will give me the numbers from o to 20. Okay? So now what I'll do, I'll write one loop here. And I'll use a variable i. So for each value of i in D, for each value in this vector d, What I wanted to do, I want to write. And then I want to do i plus one. I equal to i plus one. Let moon, I will say with Latin. So let me run this and see what we are getting. Ceo, what I am getting, I am getting 234 up to 20. So what it is doing, it is checking whether this Indie, for IE, it will be 118 not there, then it will increase by 12. So it will come and check here too is the adding d. It will print two, then it will again, i equal to three. Then it will print three. Like that. It will print till 20, and then it will come out up the low. So this way we can use the for loop, right? In the same way what I can do if I put here a simple thing. Ld move this. And yeah, what else do? I can put it condescending sit here. I equal to so porch 15. Then what I lu l print, I write. If I were to obtain, I'll print iii Next, and then I'll print. Print. So see you, what will happen when we've done this. Again? See what is happening to each value in IE. It is printing this mandate is checking the value. If I put in it. What would the next? So you see you 2345678 up to 1314. It is printing correctly and then it is Cinco KI equal to 15. Next, next means it will skip the this i iteration. So 15 will not be printed here because next means it will skip this ICT racer. So the footprint with this i plus one will be escaped and 15 will not be printed. And then it will go to the 16, and then 161718192020 print f. So next means it will skip though that I trace on. So if I use here, suppose 17 lend, thus 17th addresses will be skipped. Cia tripling 16-17 will not be printed and 18, okay, so if you want to skip one nitrogen you can use next. I hope you got the idea of how to use next. See you inside the next lecture.
17. Functions in R: Hello and welcome back. So in this lecture we are going to learn functions in R. So in our data, types are functions of the one is built-in functions, Milliken functions, and the other one is user-defined voxels defined. Okay? So there are two types of fossils. We can for instance, and usually find fossils. So first, let me tell you what these are. Function, function is actually like if you want to execute our thumb group of statements and perform some calculations that we want to. I'll do something. So it's basically like a function is a keyword. And in function we basically perform group of statements, Okay? Our group of functions of group up calculations we do, we perform some calculation or we do something. So that is our function. Okay? So let me tell you the basic structure of a function. So suppose our function takes, suppose that this is a function or in R. And what it takes, it takes arguments rate. So it takes arguments, so it can take any number of augmented argument, one, comma two. So this will be a function, okay? And in this function we can do anything with this argument's rate. Suppose these arguments can have some value. So I can support, I can use like some off these two arguments. So I can perform argument one, argument two. And I can like print some of these 12 monthly. So this is one function where what I am doing, I am for forming some of these two argument, argument one, argument two. And I'm finding some of these to augment one plus sigma two. So this is one function and I can call this function by passing the argument. So suppose I will give some name to this function, some function, and assign this, this whole function. And I'll give written Nim sum function. Okay? Now, what can I do? I can call this function by passing the two arguments, argument one, argument two. So I can do some fun. And here I can perform link three comma six. I can, if I run this liquid under forced and lambda, some fun. This was, and then I'll run this, see, okay, here it is. So let me run it again. And if I call the function by passing, ok, this is also wrong. Sorry for this mistake. And if I call this function by passing these two arguments 36, I will get the result as nine because three plus 69. So this is one user-defined function, right? And we have already seen built-in function. So what are the built-in function we have seen, we have seen sequences like sequence one comma eight. And this will give us the sequence of numbers from one to eight. So this sequence function is a built-in function that we have in R. So this is built-in constant renamed it. We need not to write a program to print the numbers from one to eight. This will do automatically because in the sequence function has been treated behind like in the order far it is. It has been defined that when we use sequence and will provide two arguments, one is to eight, it will then repeat the numbers from one to eight. So that is already been defined and that's why they are known as knowledge user, sorry, weighting functions, right? So these are the influencers in the similar way we have seen some, some are one is to eight. And this will give us the sum of numbers from one to eight. It will give us the results statistics in the same way. We have the mean function. So I'm typing here mean. Like suppose I will get to number 23 comma 9087. And if I hit Enter, I see 23 can also mean two comma nine and hit Enter, I'll get 5.5. So we can use doc mean some sequence all these at the built-in functions. So we have seen these ads up, user-defined function, user-defined and this sequence and some water built-in functions. Okay? Now what I do, we can see how we can call this some function. Okay? So let me copy this sum here. So we can call this function by providing the arguments here. And we can also call this as x one comma 29. See, I'm getting tacky to this way also. We can, this is by poor diesel and this is very the argument name. Okay? Argument, argument one equal to, for an argument to equal to nine, like this we can provide. So this is another way of calling the function. Ok. Now what I'm going to do, I am going to write our function to find the square root of cities up number of series of numbers. So what I'm going to do here, I will Kalita. Square function. And I'll pass to this boson number, a sequence of numbers. So I'll use the for loop field. And what I'll do for i in e two. Okay? So whatever number this will be from that number to ten. I want two numbers, sequence of numbers. And then what I want to do, I want to assign I, I want to square the eigenvalue, okay? And assign it to b. And then I want to bring to the B value, okay? So this is the function squared function that I'm defining here. And now what I will do, I will call this square function by passing a number supports for. So what it will do, it will first create numbers from four to ten, and then it will square the 45678 up to ten, and it will print the number sockets. So let me run this. See here we are getting 16. Flash number will refer for this quest 16. Then it will print 16. Then the next number will be five. It will print printing 55 squared, 25, then 636, seven forty nine seventy square forty nine, sixty four, eighty one and kinda squared a 100. So this way we can create a simple function that will find this quite off series of numbers, or citizen number is for propane. And we are getting here four to ten square. Each number will be squared, n will be getting the discharge. Okay, next thing is what I am going to do. I'm going to find the sum of even numbers. So I'm going to write a program to find some off even numbers between two numbers. Ok? So what I will do, suppose one protein. First, I want to find 12 even numbers between one to ten. Some of even numbers, okay? Not describe some of the even numbers, okay? So Waterloo and write a function sum of even and odd function. And what I do, I will write here first transgender to the even number. And how to generate even number. And you see an algebraic one for even numbers. So what I look, I'll multiply each number by two. So it will be sum up the numbers between one to ten. And then we're going to do print and print the water. Lewell. Do the sum of these even numbers. So and faster even number, the sequence of numbers too though, some, some unsung handle it. Some before that, let me bring to the even number. Okay? And then I'll come out and I'll call the even function. Okay? So let me run this. Okay, this is the lowercase c. Ceo Foster, I'm getting 246810. Some of even numbers from one to ten studies, some of the even numbered from one to 20, okay? Because I am multiplying by two. If I make it five, it will be the earlier what we have written. It will be that, okay, 246810, ok. So this way we can sum of even numbers, some numbers. And then when you get done with this function, sum of even number three, it will sum everything and it will give us the result. Okay? So when you sum these numbers, you'll get a 110. So this way we are getting dust some of even numbers between two to 2001 to 20. Ok. So this way we can do it. Next thing is I'm going to do calling function without document. This is very simple, calling function without augments. So what I'll do here, I will simply create a function hello and an h function keyword here. And inside the function keyword Waterloo. See even here also we have called those some of even, some of even function without passing any argument. Okay, the same thing we are going to do here as well. What I'll do here, I will simply use a print and I'll say hello. Okay? And then come out and say hello. And thus, I guess call it, Okay. So before data to run this. So let me run this and see, yeah, we'll get an Hello. How are you? So this way we can call a function without argument.
18. Matrices in R: Hello and welcome back. So in this lecture we are going to learn about metrics in R. So matrix in R is very important concept and we need to understand it. Because when we go further beyond this class, when you go and try to implement the arc concept to analyze the data. When you try to use the R4. Data manipulation data visualization are even though data mining, data analysis and in data science projects, in machine learning. So mattresses or going to unfold and we are going to use it in many places. So in our matrix is an object or object. In our everything is an object. And in that way, mattresses or also our objects, right? So mattresses are the art objects in which the elements of the same atomic types arranged. So in matrix, matrix we are going to orient the same type of elements, same atomic types of elements, okay, in poor diamonds melts rectangular layout, so it will be two dimensional rectangular matrices. Matrix is a function. So how we are going to create the matrix? We are going to use the matrix function that is inbuilt in art, create metrics in art. And the syntax would be matrix. And then we provide the data. Data means the matrix elements we are going to provide you. And then we are going to provide number of roads. And rho is number of rows in the matrix and then n number of columns in the matrix. And then we are going to see vital. We want to add in the elements by rho or by column that we are going to define by this argument. And then we are going to give the demonstrates named him name means we are going to keep the name of the name instance. Okay? So data is input vector, which becomes the data elements of the matrix in general is the number of rows to be created and call it number up columns to be created by Roy's logical clue if true, input vector elements are arranged by rho. So if you want to create a matrix by assigning the elements by row, we have to give by rho equal to true. Otherwise it will be, by default, it will be arranged in a column way, okay? Columnar values, like if we are given element one to ten, it will be 123 column wise. It will be, if you give true, then it will go by by rho hockey. And deme name is name assigned to the rows and the columns. Ok, so this is the fundamental we should be knowing. And now what I'm going to do, I'm going to create matrix. Ok, so for that, I have already created our file where I have written a few programs or few functions to create metrics so that we don't waste our time in writing the code and again and again. And while writing it takes lot of time. So I have already created this mattresses dot files and I'll Explain what I'm going to do in each and every steps. Okay? So first thing, we are going to create a matrix where elements are arranged sequentially by column by default. Ok, so suppose I am creating a matrix and I'm giving it a name M1. So yum one will be an object in R which is going to contain this matrix. So I'm going to use matrix function. And here what I'm passing, this is the data, data I'm passing 12 to 35 means it will create numbers from 12 to 35121314 up to 35. So this will be done data and then what I am giving the next one thing and row number of rows six. So I'm just passing the data and given the row number of rows. And I want to create a matrix which is having number of Rosa six. That's it. I'm not giving any column value or anything. I'm just passing the data to target five numbers and number up road S6. I'm not giving by row, by column. Okay? That argument, I'm not passing joke. So I'm just creating a matrix which is having, which will be created with the six rows and it will refill it with a data plan to 35. So let me create it. If I run this, see ya, M1 is one is to six, so one is to 412 to 36 data will be provided. And if I bring this m1 matrix C, Now we have six rows, 123456 rows, portal six roots. And in this six rows, our data, 121314, CEO foster, column one will refer see column 1121314151617. Then it will go to the column two and then 24 to 29, and then started to stratify. So this way, so data is being filled by column wise, right? First, column one and column two, and column three. Okay? Because I have not given anything, yeah, I've noticed specified by rho equal to something here. Okay? Next thing is, if I use by rho equal to false, what it will do, it will do the same thing. If I run this as well. Again, I'll get the same output, same matrix will be printed again. But if I provide here the same core by rho equal to true. Now though, matrix will be created by filling the Roche fast, so fast. 12131415, first row will be filled, then 161718, second rule, then 20212224, fourth row like that. Okay, so first the rules will refer and then the second row, then third row like this. And here it was first row, then second row, first column, second column, third column, like that it was filling here, first row, second row, third row, row wise, or column wise here, row wise. So if we want to filter data by row, you have to give by rho equal to true. And the next thing is giving the column and row names. Suppose I want to give the column name here, and I want to give that role_name also. So how I can do that, I can use c function and I can give names to the columns and rows. So suppose I want to then a six rows. I want to give each row named row one, row two row to row six. So I'll use the c function and I'll create an object of row names, and I'll create another object, column names. When I'll give column one, column two, column three, column four, whatever name you want to give, you can give you. Then while creating the, while creating the matrix, what I'll do, I'll first boss dot data matrix inside the matrix functional fastforward the data. And then I'll give number of rows six. Then I'll give by rho drew this you can give true or false whatever you want. Okay? And then the next argument will be deemed them diamond son's name. And here what I'll do, I'll create a list and inside the lift, what I'll do, I'll pass the row names and row columns as an argument. So this will clear the diamonds and sparked the matrix. Rows and column name will be fetched from here and pass on to them list. And it will give you the row and column name for the matrix. So let me run these two lines. Okay, sorry, I need taught on this whole thing's CEO. Now we're getting a matrix with the column name, column one, column two, column three, column pore, and row names as row one, row two, row three, row four, row five, row six. So this way, first we need to create column list of column names and column names and columns name. And we need to provide those to dim names argument okay, through a list, okay? And then it will be created, the row and column names will be given in that matrix. Next thing is accessing the elements from the matrix. So suppose I want to access the element from the M5 matrix, first column. And Todd Rose, How can I do that? The third row, three comma one, m phi, and then the capital bracket and three comma one. It means, I want to fetch though thought column, sorry, row and first column. The first argument is for the row and the second one is what? Quantum third row first element will be printed. Todd role means this one and the column one with 20. So if I run this, I'll get, I still get 20 years 30 char c, we are getting 20. So m5 is the matrix, and I want to find the top column, top row, first column, third row, first column. Similarly, I want to first off value of the fifth row, second column flip through. This is the fifth row and this is the second column TO 29 should be printed. He'll say, Yeah, we're getting 29. Similarly, suppose I want to face dot row six. Okay? So I can give m5 and rule six and column value will live it. So if you give like this, what will get? You will get the row six value C0. Thirty two, thirty three, thirty four, thirty five. So this is the row six. You'll get that ok. Similarly, if I want to access the second column, I can give, I can leave though row ALU, and I can give one leader column value. And if I run this, I'll get dot column to see 1317. This is column 21317. Twenty one, twenty five, twenty nine thirty three, twenty nine thirty. So this way we can fetch up column value. Next thing is matrics, Edison and subtracts on weekend. Do multiplication, addition, subtraction, and division with the matrix a. Suppose I have m1 matrix, let me print this. See this is the m1 and I have another matrix that is M2. So both are same metrics, but what are the different, different metrics, but the values are same. Okay? So suppose I want to add m1 and m2. I can simply do m1 plus m2. And I'll assign this value to some object. So if I run this, and if I print the sum value of CEO, allocate 2436 like this top 2012 plus 122413 part starting 2614 plus 1428 like that. Ok, similarly we can do m1 minus m2 and we'll get 000 because both the metrics are same, right? M1 into m2, we can do multiplication, sorry for this. C, 12 into 1212413 into exacting 116 like that. Okay? And in the same way we can perform the matrix multiplication where the, each element will be divided by each element, okay? See, yeah, well by 121, like that. Okay? So this way we can use matrix and we can perform it isn't subtraction and we can access the metrics, elements.
19. Factors in R: Hello and welcome. In this lecture we are going to learn about does in R. So what is factor into? Factors? Are the data object enough like we have done so far? And that everything is an object. And so factors are also data objects in R which are used to categorize the data. So basically factors are used to categorize the data and then store those categorized data into those levels. So first it will categorize the data, and then it will create labels for those, categorize data. And then it will store that labels. It will store that data into those levels, right? And Factors are used to represent the categorical data. And they can store both strings and integers and treat it as an integer vector having a level. Suppose integer vector having a level, something like that. Okay? So basically suppose we have, suppose a male or female. So we can store that. It is better to store that as a genuine one, right? So what it will do it, suppose we have a data of air mail and feed some data of population where we have our data for male and female both. So what factors will do it will compute a category of beta with male and female, and it will store that data in the category of male and female. And then easily you can find how many males are there and how many females are there, something like that. Okay, so let me open the file that I have created for factor. So I have already created a file factor in R dot R. And here, I'll, sorry, how to create a factor in. The first step to create a factored in R is creating a vector. So here what I'm doing, I'm creating a vector profession, profession. And here inside the profession vector, there will be Dr. engineer, carpenter, Dr. mechanic by lead, Dr. carpenter, engineer like that. Okay, so there are few professors I have created here. So this is the professor vector where I have kept the profession of the person's. Okay. So if I run these two lines, what it will do, it will deviate and vector, right? And it will have doctor, engineer, carpenter doctors. So see a doctor is repeated here, right? Doctor. So many doctors out there, right? So suppose this is a vector that I have created. If I want to check whether this vector is. Factors or not, I can use a function here called each factor. So anything if we want to check if a factor or not, you can use each factor Frank's on and boss that vector R object to dot each factor function. And it will give you that it is a factor or not. Okay, so let's run this. See here it is swing as false. It means this vector is not an factor. This is a vector not a factor. How to convert this from k, some vector into factor dashed. What we are going to do next step. Next step is apply the factor function. So support now I want to convert this Professor Rudolph factor. So I'm creating another, creating another object that is fractal underscore professing. Okay, so now I'll use the factor function and I'll pass this, prophase some vector to the factor function so that this professor vector will be converted into the factor. Okay? Now, if I run this, and if I run this, what allocate CEO. Now, this step will create though factor from this professor vector. So now this factor, professor nasal factor, so I can tick here. It's factor c here it is, showing us through. And when I'm printing this factor professional, which is a factor, what I am getting, I am getting see I'm getting the same result. Doctype, carpenter doctor like that and the same data. But here I'm getting another output that is labels. And labels are carpenter, teacher, doctors. So all those things will be the labels, right? Yet the levels are carpenter, Dr. Driver, ingenious, mechanic, pilot, and teacher. If I use the table function and pass this factor to the table function, what it will give. It will give us the same thing, levels, okay? And if I use somebody, what we like it, see, if you use somebody, you will be getting how many carpenters are there in this data? So two carpenter, three doctors, one driver to engineer, two mechanic, to pilot, and to teach us. Ok. So this way we can create and vector into the factor. Factor will see yet it has created a factor, carpenter dr. And it is giving us the data like there are two doctors, there are two carpenter, three doctors, one driver like that. So it will categorize the data. You know, the factor, what factor has done. It has categorized this data, this data into the category of Professor Carpenter, dr. And it is giving us the numbers like these many carpenters are there, these many doctors and engineers are there in our data. So the fact of will be useful while analyzing the data which are categorical data, right? So we'll see how we can do Categorical Analysis Using factors in up. So for now, it is enough to understand how to create a factoring are from the vector. Okay? So we can apply factor function to the vector and that vector will be converted into the factor. And the condition is this professor vectors to be having some categorical data. Okay? And then we can check each factor function. With the, each factor function, we can check whether a vector is a factor or not, okay? And we can use table to see the levels of the factor and we can use the summary function to check what are the numbers, are the lake harmony, our doctor, how many engineers are there? So somebody up the factor will be seen by using somebody function, okay?
20. Data Frames in R: Hello and welcome back. So in this lecture we are going to learn about data frames in R programming and how we can use DataFrames. That what the topic of this lecture. So let me first tell you what is data frame. Dataframe is a table order two-dimensional, array-like structure in R, in which each column contains values of one variable and each row contains one set of values from each column. You understand what I said. Dataframe is a table-like structure or two-dimensional array. You can see in which each column contains values of one variable. Each column will be containing values prong one variable and each row contains the set of values from each column. Okay? And it is a special case of list in which each component of each component we'll have the equal length, okay? And each component from the column and content of the components on the road. Understood. Each component from the column. Each component will form the column and the content of the component will form the roads. Okay? You will understand when we do the hands-on, you'll understand it better. So our DataFrame in R will have following features. The first thing is row names must be unique, so role_name should always be unique. So row names would be unique. You cannot have the same row names in a DataFrame, okay? So each row name must be unique and then column name not be empty. So column name should not be empty, it should be a non-empty. So all the column names would have entries, okay? And data stored in a DataFrame can be often numeric factor or a character types. So any of these type data you can store in DataFrame, numeric, factor, or character type. And each column contains the same number of data items. So each column, so it contains the same number of data items. Ok? So DataFrame is a table other two-dimensional, array-like structured in art in which each column contains the value of one variable and each row contains the set of values from each column. Okay? So let's get started with the practical. Okay, so what I have done, I have already written program. So and the file limit DataFrame dot are what I'm doing here. I'm creating a data frame. So DataFrame can we created as follows? So what, how we create a DataFrame? We use data.frame, data.frame function we'll use to create. Data frame. And this student is an object too, which I'll assign this DataFrame. Okay? So data.frame. And then what I'm doing here, fostering, I'm creating silly serial number. Okay? So serial number, I'm creating from one to five, okay? And then it, I'm giving, I'm using c function to create the is. Ok. So I'm creating a vector Yasi 2115103545. So it will have these entries. Then I'm creating Name. Name will have the money entries. Okay. So five entries show good honest risk, John and Tom. And then I'm closing this ok, so this way we can create a DataFrame. So let me run this line first. So create a DataFrame. So c here. And then let me print this. Student CEO. Now, the student visa DataFrame, right? And what it is containing, it is containing a rule, a columns as serial number, age and name because we have given serial number, then it, and then name. And each column serial number is, and name will contain the values what? Cdl and Marie will contain the value one to five, so 12345 serial numbers, and then it is 21 footprint in 3540 and name will have these values, okay? So each column will have the values from name, okay? Name, variable rate, test what we learned in the theory part. So this way we can create our dataframe student, which will have the column serial number is a name, and it will have the row values from city lumber from one-to-five, ages 215 is we have given a name we have specified in the name valuable. So these variable values will become the entry into this TE, one, right? So it's so table-like structure. Okay? So this is what known as data frame in R. And we can see the structure up our DataFrame by using STR function. We can use SDR and then we can pass the DataFrame. It will give us the structure of the data frame. Ceo, the DataFrame had structure and Lucy DataFrame. And it is having five Raj from three variable sr 12345. So five objects are five rows and three variables. Three variables are, serial number, is, and name. These are the three variables. Okay? The column names are known as valuable. So three variables, okay? And five rows, five objects up three variables. And these variables are serial number, is and name. So serial number is integer, is, is numeric and name is of character type. Okay? And CEO, each. Variable on each column will have same number of items like serial number is one-to-five. Age is also having five entries and name is also having five entries, right? So also would have the same number of entries, right? Okay. Suppose, if I give six year, what will happen? Let me run this. See a lot in DataFrame. Because the serial number is having one to six and it is having only 53. And name is also having five entries, right? So what error we are getting entering dataframe and it is suing arguments imply differing number of rows, 665. So one variable is having six rows, six items, and all others are arriving five only. So that's why it is showing us the era. So you should be 55 foreach, ok, so here you can put phi and then when we run it, we will not be getting any error. And it will be running successfully. Okay? And with the STL, we can get the structure of the DataFrame. Next thing what we are going to learn, DataFrame components can be accessed like a list or like a matrix. So fast we'll see accessing list. So we can use, if you want to access like list, we can use either of these three. We can use our dollar operator or we can use the double bracket, or we can use the single bracket, okay? To access the data from the dataframe. Ok, so suppose I want to access the name from the dataframe student, one link name. So if I can do that with this student, and then inside the column, I can pass the variable name or column name. Okay? And if I run this, I'll get all the names from the dataframe. Similarly, I can do the same thing with this dollar symbol rate, dollar operator Student, That is a dataframe name, then dot and then the column name out of variable length. So here, if I run this, I'll get the same Digital SR is student dollar name will give you all the students name. Ok. And similarly, we can do this as well, is to rent. And in the bracket, again, inside the bracket we can pass the name. These three things will give you the same result. Okay? Now, we can do like here we have given name. Name is that third column right inside this DataFrame. So we can pass the column number as well as student three. So it will give you the third column C, the name, namely the third column in this DataFrame. See, if I give two, it will give us the h c here, it will give us the is. So this way we can pass the column number and fetch the data from the data frame. Now next thing is modifying the data frame elements. We can modify that data frame also how C will give that student, that is a dataframe names. And then here will give the 11 means the first row, and then I'll give h. And I want to modify the first row is 291. Okay? So let me run this and let me print the CEO. Now the first row is, is modified to 91. Earlier it was 21, now it is 91. So this way we can modify the frame DataFrame elements. We can add rows to the Roche component to the DataFrame. Suppose I want to add another row. Suppose here five rows are there, right? I want to add one more rows to the DataFrame Hollywood. I can do, I can use the rbind function. Rbind function is used to add a row into the DataFrame. So inside the turbine, I need to pass the data frame name and then up to use a list. And inside the list I have to pass the serial number six, then is 120 and then the names would be they're so Rava T, so nothing so empty. Everything we have to give. There are three columns, so we have to get three columns here. See the lumber is And though name. And if I run this, one more rules, rho will be added CO six hundred twenty two fifty has been added to the student DataFrame. Similarly, we can add column component to the column component to that DataFrame as well. And how we can do that? We can do that with the C1 and C1 myths, Columbine, RBI myths row bind. Okay, so cbind function we use to add a column into the DataFrame. So inside the same thing, we need to pass the data frame name and then we have to suppose a column I want to add as a country. So I have to give the column name country. And then after US does C function and have to pass the country number up countries. So here I need to pass the six countries and invade 12345, okay? And if I run this c here, because the six value that we have not committed, so it is not coming here. Or in a DataFrame is having only five rows two, it is adding the phi one. Ok? So this way we can add another column like contrary to our data frame, okay. Next thing is, we can assign the country in a list like mine up Lake. List like assignment weekend US student, dollar country. It means in the strength DataFrame, we are going to add another column. That is, that will real name, country. And we are going to add the entries like these countries, okay? Six IN india and New Zealand, US, Japan, and China. Ok. And if I run these two statement, I'll get the country has been added here and the country names are here. Okay? So this way we can add a column in a list like assignment. Okay? Next thing is we can delete a component from DataFrame. So we can delete the entire column by using this thing. Okay, student that a data frame name, dollar, and here column name, name, and I can assign null. So if I assign null, the entire column will be deleted. So let me run this and see. Now serial number is and countries, their name column has been deleted because we have made the name column as null. Okay, so this way we can delete the entire column. In the same way we can delete entire role. So to delete and title what we can do, we can use student and minus two, and then we can delete the intangible. So let me run this. See here, the row two has been deleted. Co two is 2-15 newline that has been deleted. So if you want to delete a particular row, you can provide 3m minus two means the second row will be deleted from the student data frame. So this way we can delete an entire row from our data frame. So this is how we can create a DataFrame using data.frame. And we can provide the number of columns or number of variables. And then we have to provide the number of values for those variables. It should be equal number of items here, five, so all is a names would be 55, then only it will create a DataFrame. Then we can get the structure of a data frame by using STL function. Then we can face the particular column using by providing the column name using this bracket or the dollar symbol. And we can, by column number, we can modify data frame like this, DataFrame elements like this and all those things, cbind R1 and all those things we have seen, right? So I hope you got the better understanding of data frames in R. And I hope I make you understand what is dataframe and how we can walk with DataFrames. See you inside the next lecture.
21. Combining Data Frames: Hello and welcome back. So in this lecture we are going to learn about how we can combine vectors into DataFrames. It means we suppose we have three or four vectors. And I want to create a DataFrame from those vectors. So how we can do that? And then secondly, what we'll try to do, we will try to combine those data frames as well. Okay, so let's get started. So first thing first, to combine the vectors, we need to create the vector. So here what I'm doing, I'm creating four vectors, names, city, zip code, and salary. So these four will be the four vectors that I'm creating or for objects I'm creating. And what I'll do, I'll combine these for to create our DataFrame. So these four vectors will create one DataFrame forming. Ok, so first, victories, names. And in the name vector what I'm giving, in the names vector what I'm giving, I'm using the c function and I am giving the names of the Parsons lactamase Rockies, Henry and monte. And then the second vector is 60 rotor. And inside this I'm giving them this particular, their respective cities named like Bangalore, London, New York, and Mumbai. Okay, and then I'm giving that, give code for these cities in the third vector. And then the fourth vector is salary, in which I'm storing their respective salaries or this will have the highest salary Iraqis salary and reassembly and Monte salary, okay? Monte salary. These four vectors we can create by this that we have learned in the vector chapter, OK, in the lecture of vectors. So let me run this. So this will create these four vectors, okay? Now I want to combine these four vectors and create one DataFrame. I wanted to create one data frame by using these four vectors. So I want to combine these four vectors and carry it one DataFrame. So for that, what I am doing, I am giving a data frame name here imply details. So EMP dot details will be the data frame name. And what I'm going to do, I'm going to use cbind function to combine these vectors. Okay? So because this name CTD port will be dot, will be the column steam. So naturally I'm using c bind here to combine the columns. Okay, so names, city, deep codons, LEDs are the four, this will be the four columns in the DataFrame. So I'm using c Wine and I'm providing the columns name, like names vector, city vector d, current salary. Okay? So let me run this. Okay. Now. Let me print time employed it is. Okay. So let me see that the denser in procedure now that imply detail is dataframe. And we can see the columns Name, City, Gibbs coordinate salary. And the entries are dummies Bangalore. And your current salary lack is Citi, London court this and the salary then Henri. So CF from these four vectors we have created, for, sorry, with these four vectors, we have created one DataFrames, right? Suppose if I put the names and if I run this name, what I'll get, I'll get one leader named straight OK, and similarly, city and the current salary. So I have combined the vectors into a data frame. So now we have our table-like structure here that is a dataframe. So now we have one data frame. Similarly, what will I do? I will, you can use the CAT, CAT function to print something. Ok, so here, unjust in the fall DataFrame from four-vectors and this, and then it will come like this. Ok, so the first DataFrame from for vectors is this implied details, EMP dot details. Ok? So if we want to print a headline, you can use the cat function, okay? And then print the implied it is, I have already printed here. You can print it here as well. And then what I'm doing now, next task is I want to combine two DataFrames into one. So we have one DataFrame, employee details that we have created from the four vectors. Now what I'll do, create another vector. Sorry, I will create another data frame, employee details to EMP dot details too with the Hale-Bopp DataFrame function. And here, manually. Inside the data frame I'll give the name vector, city vector, give goal, salary. Ok. So this way also we can create, in the first step what we did. We have created the name 3D deep core salary vector separately. And then we have bothered to cbind function to create a DataFrame. And what we are doing now, we are directly passing this vectors. We are creating the vectors inside the data frame function. We are not Agency by India. We are using data.frame DataFrame function to create a DataFrame. And inside the data frame function we're passing, we're creating names. Vector, density vector, then the code vector and enrich also we are giving here only ok, salary. And a string adds factor faults. Okay? And then if we run this, we will be creating one DataFrame. That is implied details too. Okay? And if I hit on this two, what we will get, we will get the second DataFrame that each employee details to name strategic code. And there are three entries, Locke's RAM and push pop and their CT deport undressed productive salaries printed here. Now we have the two DataFrames, employee details and imply details to what I wonder do I want to combine the root from both the DataFrames and create another data frame that will be all employee details, that will contain all imply details from imply one and implied two DataFrames. So I'm creating another object, all dot employee dot details. Ok. This will be the DataFrame which will combine the Raj from imply detailed frame prim dataframe and implied it is two DataFrames. So for this, what I am going to use, I'm going to use our bind outline because we want to combine the roads. Here, three rows and here are four rows to these four rows. And these three rules I want to combine and create another data frame. Actually I'm using autobiographical combined dot rows. And then inside of the RBI nel provide the fast data prep and then the second DataFrame. And then we can use the cat function to print the headline so that combined implied it is. And then I can print OK. So let me run this. See here now we have all imply details DataFrame with which will be containing all seven rows. The 4x from the first DataFrame, and the last third is from the second data frame. So the, in this way we can combined two data frames. Okay? So what are the things we have learned? We have learned how to create a DataFrame from vectors. And then we have seen how we can combine the two DataFrames into one DataFrame. Ok, so this way we can combine the data frames and we can create a DataFrame from the vectors, as we'll see you inside the next lecture.
22. Recursion in R: Hello and welcome back. So in this lecture we are going to learn about recurse on, in our programming. So what is recurse on r? What is recursive function? So recursive function is a function which calls itself multiple times. So suppose if you want to perform the same operation again and again, we can use the Dickerson to don't act like you must have learnt like somewhat natural number, Salafi when number, all of those things, right? So these problems like finding some natural numbers where n can vary from one to any number up to 1012 thousand, something like that. So here to solve this kind of problem, we need to use the Dickerson and recursive is very importa