R Programming A-Z™: R For Data Science With Real Exercises! | Kirill Eremenko | Skillshare

R Programming A-Z™: R For Data Science With Real Exercises!

Kirill Eremenko, Data Scientist

R Programming A-Z™: R For Data Science With Real Exercises!

Kirill Eremenko, Data Scientist

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
74 Lessons (10h 19m)
    • 1. Intro

    • 2. Welcome to the R Programming Course!

    • 3. Installing R and R Studio (MAC & Windows)

    • 4. Exercise - Get Excited!

    • 5. Welcome to the CORE PROGRAMMING SECTION section. This is what you will learn!

    • 6. Types of variables

    • 7. Using Variables

    • 8. Logical Variables and Operators

    • 9. The "While" Loop

    • 10. Using the console

    • 11. The "For" Loop

    • 12. The "If" statement

    • 13. Section Recap

    • 14. HOMEWORK: Law of Large Numbers

    • 15. Welcome to Fundamentals of R SECTION

    • 16. What is a Vector?

    • 17. Let's create some vectors

    • 18. Using the [] brackets

    • 19. Vectorized operations

    • 20. The power of vectorized operations

    • 21. Functions in R

    • 22. Packages in R

    • 23. Section Recap

    • 24. HOMEWORK: Financial Statement Analysis

    • 25. Welcome to the MATRICIES section. This is what you will learn!

    • 26. Project Brief: Basketball Trends

    • 27. Matrices

    • 28. Building Your First Matrix

    • 29. Naming Dimensions

    • 30. Colnames() and Rownames()

    • 31. Matrix Operations

    • 32. Visualizing With Matplot()

    • 33. Subsetting

    • 34. Visualizing Subsets

    • 35. Creating Your First Function

    • 36. Basketball Insights

    • 37. Section Recap

    • 38. HOMEWORK: Basketball Free Throws

    • 39. Welcome to the DATA FRAMES section. This is what you will learn!

    • 40. Project Brief: Demographic Analysis

    • 41. Importing data into R

    • 42. Exploring your dataset

    • 43. Using the $ sign

    • 44. Basic operations with a Data Frame

    • 45. Filtering a Data Frame

    • 46. Introduction to qplot

    • 47. Visualizing With Qplot: Part I

    • 48. Building Dataframes

    • 49. Merging Data Frames

    • 50. Visualizing With Qplot: Part II

    • 51. Section Recap

    • 52. HOMEWORK: World Trends

    • 53. Welcome to the ADVANCED VISUALIZATION section. This is what you will learn!

    • 54. Project Brief: Movie Ratings

    • 55. Grammar Of Graphics - GGPlot2

    • 56. What is a Factor?

    • 57. Aesthetics

    • 58. Plotting With Layers

    • 59. Overriding Aesthetics

    • 60. Mapping vs Setting

    • 61. Histograms and Density Charts

    • 62. Starting Layer Tips

    • 63. Statistical Transformations

    • 64. Using Facets

    • 65. Coordinates

    • 66. Perfecting By Adding Themes

    • 67. Section Recap

    • 68. HOMEWORK: Movie Domestic % Gross

    • 69. Homework Solution Section 2: Law Of Large Numbers

    • 70. Homework Solution Section 3: Financial Statement Analysis

    • 71. Homework Solution Section 4: Basketball Free Throws

    • 72. Homework Solution Section 5: World Trends

    • 73. Homework Solution Section 6: Movie Domestic % Gross (Part 1)

    • 74. Homework Solution Section 6: Movie Domestic % Gross (Part 2)

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class

Learn R Programming by doing!

There are lots of R courses and lectures out there. However, R has a very steep learning curve and students often get overwhelmed. This course is different!

This course is truly step-by-step. In every new tutorial, we build on what had already learned and move one extra step forward.

After every video you learn a new valuable concept that you can apply right away. And the best part is that you learn through live examples.

This training is packed with real-life analytical challenges which you will learn to solve. Some of these we will solve together, some you will have as homework exercises.

In summary, this course has been designed for all skill levels and even if you have no programming or statistical background you will be successful in this course!

I can't wait to see you in class,


Kirill Eremenko

Meet Your Teacher

Teacher Profile Image

Kirill Eremenko

Data Scientist


My name is Kirill Eremenko and I am super-psyched that you are reading this!

Professionally, I am a Data Science management consultant with over five years of experience in finance, retail, transport and other industries. I was trained by the best analytics mentors at Deloitte Australia and today I leverage Big Data to drive business strategy, revamp customer experience and revolutionize existing operational processes.

From my courses you will straight away notice how I combine my real-life experience and academic background in Physics and Mathematics to deliver professional step-by-step coaching in the space of Data Science. I am also passionate about public speaking, and regularly present on Big Data at leading Australian universities and industry events.

To sum u... See full profile

Class Ratings

Expectations Met?
  • Exceeded!
  • Yes
  • Somewhat
  • Not really
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. Intro: Let me ask you a question. Are you tired off learning our programming but never quite getting there? Are you frustrated with the books and courses that promise to teach you the language but are way over complicated? Well, in that case, welcome to the only course that will make the complex simple. My name is Carol Eremenko and I will be your instructor. So what makes this course stand up? While several things, first of all, in every single tutorial, you will learn a valuable new skill. And in every single section you will see how to apply those skills to re a world projects Next. This course is designed to take you step by step through the steep learning curve of our So you never get lost and you always feel on top of your game. And finally, this course is extremely fun because we will be using specifically designed datasets and will be an exciting way to practise the skills that you learn. And now let's have a look inside the core Suk and decide for yourself. If it's right for you in this course, we will start up with the very basics. But even then we will already learnt how to combine programming and statistical concepts. Then we will move on to more advanced topics such as matrices and daughter frames. And every time there will be ample theory as well as really live examples to support our learning. And on top of all of that, in this course, you will learn how to create the most stunning visualizations that will help you deliver your analysis and truly captivate your audience. And these are just a few examples off what we will cover inside this class. Did you like what you saw? Well, if you're interested in finally mustering our programming and skyrocketing a daughter science carrier that this is the course that you have been looking for Click to take this corresponding now and join the claws and I look forward to seeing inside. 2. Welcome to the R Programming Course!: hello and welcome to the course and our programming. I'm super excited that you decided to join. And I can promise you right now that in this course you will learn a lot and we will have tons of fun along the way. And I have designed this course specifically to address a pain point that I personally had when I was studying our programming. And that is the fact that this language has a very steep learning curve. And the courses out there just throw you in the deep end right away. And it's very hard to actually sit down and get this language going and understand it very well so that you can apply it in your work. So this course is structured differently. This course will take you step by step through everything in our and like all my other courses, you will learn gradually with lots of examples with applying your knowledge to real world problems, and you will learn a spiral structure. So everything you learn, you won't won't just move away from that in the coming tutorials. After that, we will concrete that knowledge in because we'll practice and reiterate it, and we will build on existing knowledge. So that way, everything you learn, you will get to keep and take away. After this course and what I want to do in this tutorials, I just want to quickly show you around the section of the course so you can navigate your way better. And then we will dive straight into installing are and let's jump to the presentation off the sections of the course Now. All right, so here's the course. And now if I scroll a little bit down to the sections, we will see section one here. So Section one hit the ground running here. We've got a lecture. One, which is the lecture we're in right now. Then we're going to install our in our studio and I'll show you how to do that both on Mac and PC Onda. Finally, we've got an exercise, a super quick exercise to get you excited about this course to show you all of the powerful things you will learn towards the end of the course. Yes, you will be able to already perform them there. I highly recommend doing this exercise. You will see how much power are has and then throughout the course, you'll actually learn in detail exactly what you did in a lecture. Three. So pretty interesting lecture over there. Then we've got Section two core programming principles, and here this section is designed to introduce you to programming if you've never programmed before, so feel free. Just keep it if you have programmed before, or maybe just proceed straight to the homework for this section because it's quite interesting. Is God some statistical knowledge combined of programming. If you haven't ever programmed before, then no worries. This section will get you up to speed with everything you need to know to master the rest of the course and learn our. Then we're moving onto fundamentals of our so are is a very specific type of programming language. It is old victory rised and here that's what we're going to talk about. We're going to talk about victories, operations and how to access elements of vectors, functions, packages and so on. And basically that's what the sections about. It's about the specifics off this programming language. All right, then we're moving onto matrices, so matrices are multi dimensional objects. It might be a sound like a complicated topic, but It's actually very simple and more over here. We've got a very interesting daughter, said. We're talking about basketball trends, so we're going to be looking at the top page players off the N b A. On. We're going to have a matrix. We're going to learn how to work with it At the same time, we're already going to be deriving very valuable insights, and we're gonna have a lot of fun in this section. I can't wait for you to check it out. Actually, then a Section five daughter frames. What are we talking about here? Well, daughter frames are kind of a step up from matrices, and this is the main section for daughter science. So every time you're going to be working with daughter, it's like 99% of time is gonna be a daughter from, So it's very important section to know all of this A with these things and skills that we're talking about Onda again, we're going to have a very interesting stop it. We're going to be talking about demographic analysis. We're going to be working from which some daughter from the World Bank. So that's gonna be fun. And then we've got advanced visualization. So here you will learn how to visualize. Your daughter sets on how to portray those insights that you want to convey to your audience in a very graphical manner so that it's easier to understand them. And there's a very interesting concept about visualization in our it's very layered type of visualizations who will be working with the G plant to package and you'll learn all about it on also all shoe Myriads off different visualizations that you can use and we will walk through them. And again, we're going to have a very interesting dollar. Since we're gonna be talking about movie ratings. Onda we're going to see how the audience rates movies. How critics make great movies, drops him inside. In fact, when I was preparing this section, I found some things that I didn't know person. I was like, Wow, that is so cool. So you're going to have a lot of fun in this section. In fact, in any section of the course, we're going to have a lot of fun and finally got the homework solutions. So in ah, in the section of the course, you'll find homework exercises so you can come here and then check the solutions off of the homework exercises when you're done. So there we go. That's how the courses structure. Don't forget that they're quizzes at the end of every section, so look into those. Those will also help you keep on track and refreshing allies that you just learned, and I can't wait to see on the next tutorial until next time. Happy coding. 3. Installing R and R Studio (MAC & Windows): hello and a warm welcome to the course and our programming. In this tutorial, I will show you how Tyne still are in our studio onto your computer. All right. To get started, we need to go to the website. We found a www just cran dot are hyphen project dot org's. And this is the website where you can download our now select the machine that you're using . I'm going to be using and Mac throughout these tutorials, but you can also download the Windows version here, and everything we talk about will also work with the Windows version. And now let's go ahead and download the correct file. So just select our option that you like, and then you'll be presented with some packages. Usually it's the one just at the very top. So let's go ahead and download that. You'll see it's ah, great to take a few minutes because it's quite a large package 69 or nearly 70 megabytes. So let's just false forward until it's downloaded. All right, so the file has been downloaded. We've got over here. By the way, I wanted to show you that if you're having trouble downloading the file from right here. There's a button Oy on the left, called mirrors. And if you click that button, you can select a different location from where this pile will be downloaded. And maybe you'll find something closer to you. And yes, So if you having trouble, just check out this mirrors bottom. And now we're going to proceed with installing the file. So once again, I'm on a Mac on the windows computer. This might look a little bit different, but the whole concept is the same. He just basically install are onto your computer. Okay, Install for old users. There we go. It was quite a quick installation. Just maybe a minute to two. And now we're going to close and now are is installed, right? So if I look for are you'll see that I have are over here and I can launch. Are I'm going to do that just to demonstrate what are actually is? We've got this our consul here, and you can already start programming and are in here. But the thing is that it is a console, and it's not very convenient. It's not very nice to work in a constant like this. So What we're going to do is we're going to close this and we're going to install our studio. On top of that, our studio will be like like a shell on top of the Consul to which will make our work much more convenient and pleasant in our So the follow the website you need to go to let me reload this page. The Web searching to go to is www dot our studio dot com, and if you go to this website here, you can get our studio. It's a completely free software, so what you need to do is go to products and here select our studio. Now here we can just don't want our studio desktop. That's the one we want and, um, download our studio just up open source. That's the one we want. So here, once again, you will need to select your machine type Windows or Mac. I'm good, just like Mac, and this is another 60 megabytes. So let's give this some time to download as well. All right, so the file has been downloaded, and now let's go ahead and instill our studio, so I'm going to been to double click our studio and, um, just open it up and as easy as that. So your installation process might take longer because I did originally have our studio on my computer installed. But nevertheless, once you're done with the installation, you will get our studio, which looks something like this. All right, now that we're in our studio, there's two things that we need to do. First, we're going to set up how our studio looks, so I'm going to expand this to full screen mode, and I'm going to go into the settings on the Windows PC. This might be in a different location on a Mac. Chrissy, you need to go to our studio and preferences in Windows PC. It would also be somewhere at the top. So if you go into preferences, what do you want to do is we want to change the appearance. So right now it's very white, and I find that when you program a lot, it's a bit too bright like that, like your ice can get tired. So I prefer a different appearance here. In appearance, you can select the type you like, so there's lots of different styles, and there's a preview over here. First, I'm going to increase the phone size to maybe something of 14. And here on the right, you can see a small preview off what it will look like. So let's try, try and playing that one as against. It's nice and dark and that will, from my experience. Once again, it's Everybody is different from my experience and allow your eyes to arrest. So have a look at the different options that you have. My favorite one is the couple to one, and I'm going to stick to that. And maybe actually, I will increase the phone even a little bit more. Okay, and the other thing that I would like to do is off to a click. OK, here. I would like to follow the very traditional approach to learning a programming language where your first, your very first program, is a hello world program. So let's go ahead and create one of those in order to create a new script, click the button up at the top over here and select our script, and this brings up 1/4 window over here, and now you can type in your coat. So what we want is we want to create a program that will say hello, world. And then the message will appear here. So let's go ahead and do that in our is actually very, very simple. All you have to do is open up quotation marks. And as you can see, our closes them for you automatically. So you don't forget. And inside these quotation marks, type in Hello, world exclamation mark. Now we're going to save this program. So click this button safe and give it a name. So my first R script save. And now, in order to run this line, make sure your carriage is on this line and then go and click this button up the top Run and then you go. Congratulations. That is your very, very first, our script. You have just printed out the phrase hello world on your screen. And even though this might seem as a small accomplishment, it's a very big step towards a learning our programming. And once again, I welcome you into this course that we're going to have lots off fun along the way and you will learn tons in this course. I can promise you that right now. And I look forward to seeing you throughout the lectures and until next time, happy coding 4. Exercise - Get Excited!: hello and welcome back to the course in our programming on the first question you probably have on your mind right now is Curole. Why is there a huge timer right in the middle of the screen? Well, I'll tell you, the reason for this timer is that I'm super excited about you taking this course. I don't want to get you excited about taking this course, completing it and finally mustering our programming. And in order to do that, I'm going to illustrate what a powerful tool our is and what amazing insides. You can drive with some just some basic knowledge of our in under seven minutes, so let's dive straight into it. The first thing that you'll need is a browser and in your browser, go to www dot superdawg assigns dot com slash our course. And this is the page where all of the daughter says, for this course are stored. If you scroll down, you'll find the one that we need is under Section one. It's called Miss Price diamonds. So go ahead and download that, and that way you'll be able to fall along with the code in your own computer and have the same insights on your own machine. All right, so we have just six minutes to go. Let's explore, the doctor said. Here we've got three columns. One is carrot. The next one is clarity and price, and these are all diamonds. Every row represents a new diamond, and carrot is its way to Clarity's. Its clarity and price is the price at which it was sold. And if you scroll down, you'll see that this, Donna said, has a lot of transactions. In fact, over 50,000 transactions in just this one don ascent, which makes it pretty big. And so what are we doing today? Well, let's look at this club clarity over here. He's got some abbreviations, and these abbreviations are explained in this chart on the right, so you can see that the eyes mean that there are some inclusions in the data set and in the in the diamond, and that it isn't a pure and then you've got less inclusions, less inclusions and less inclusions, and it would make sense right that diamonds that are clearer are priced higher, should be priced higher than diamonds that are less clear at the same weight and carrots and what we're going to be investigating today is, does this relationship between price and clarity always hold true? Now we won't be looking at individual diamonds per se. What we're going to be looking at is that statistical averages for clarity, so we're going to want to investigate. Does a better clarity always mean that the diamond is going to price high? Or does that relationship sometimes not hold true? And our there mis pricings in the market is going to be pretty exciting? And with 50,000 Rose is going to be pretty challenging. But with the help of our will get them very quickly. We only have 4.5 minutes to go. Let's dive straight into our studio now. I'm going to type in some code and just full along, and I won't explain everything in this one to toil. But you will definitely learn all of this throughout the course, so type in my daughter, read see SV and when filed, shoes in brackets and run this line by pressing control, enter on windows or common returning a Mac, and that will allow you to select the file that you downloaded if you located and selected . What that does is that it lowers your daughter into our now we're going to. Now that we've loaded the data, we're going to stole a package, and this package will help us visualize, the doctor said. It's called G plot to. So let's run that line, which you'll see is our studios going to start downloading this package from the Internet and installing it on two machines. So it's taking a while to think over there and there You can see the download has started its downloading this package and all of its components to still intermission. Why don't we hear in the packages tab? You will see that now we have G Platou just appeared over there. So now we're going to activate the package by clicking this check box. All right, so three minutes left, we're halfway there already. Let's call to the function called G plot and we're going to post it some variables. Daughter equals my daughter. Then X, we're going to say aesthetics and for aesthetics were going to say X equals carrot and why equals price. So we're going to create a scatter plot on here. We're going to say, plus um we want to add points, right? We want to say that we want to have a scatter plot. So we're going to say John Point. So if you run these two lines together now, John Point, I forgot the bottom part. There we go in a rush. All right, So if we run these two together now, you will see that here, we've got the scatter plot for the diamonds. Are all of the records are illustrated here, and it already looks pretty interesting, But at this stage, it doesn't tell us much because we don't have all the third variable, which is clarity here. So let's add it in gonna put this on the new line to make some space. And here I'm going to say color equals clarity. And now if I run these three lines together, you will see that the doctor said the plot is going to change is going to include clarity. And we have a legend on the right here. So now, or radio, we can see that some diamonds are priced higher. Sometimes the price law, that's a great start. But the scatter plot is quite cluttered. And we've got all these points on the right that are not statistically significant. So first of all, let's make it less clear. More clear. Will say Alfa for some transparency, call 0.1 If we run this and we check the time One minute, 45 seconds. All right, so we've made some improvements. We can already see the where there's a lot of daughter and with its little daughter. And now we're going to filter out everything to the right of this line 2.5 car is because it's not statistically significant. Not gonna help us a lot. So you will learn how to filter inside the course. But for now, just type in my daughter Dolson Carrot. Less than 2.5. Common nothing. And if you run that, that will filter your daughter set and leave only the 2.5 carrots and below. All right. And the last thing that we need here is, um, genome smooth. So let's add the smooth others so that we can see that averages for these different carrots . I'm gonna make some space here so that we can see the chart very nicely. All right, We won't need the code that much. So there we go. Let's see How much time? 57 seconds. Ok, time to derive insights. Beautiful. That's exactly what we're after. So here you can see that the lines should be in this order. So Brown is, um, with the best clarity. And then there this red is the worst clarity. So they should be in this order all the time. But wherever they're crossing each other, that means there is mispricing. So you've got some mispricing over here. These lines shouldn't be crossing like that. And then you've got a some mispricing over here, right? So some of the lines of crossing over there and some of the lines of crossing over here at the low prices as well. So as we get to the right, you can see that the confidence bands getting greater so that we have less confidence about what's actually going on because off the doctor said. But nevertheless, we can already tell where what is going on. And you can see how the diamonds are being purchased at one carrot, 1.5 carat. Wanna have carrots? Of what? Their 0.7 carat 0.5 and so on. So there we go, just on time. Time expired. We have derived some great insights from this daughter said. It was very, very quick. And as you could see, our is a super powerful tool with just a few a couple of lines of code. We were able to build this a beautiful visualization, which we can then take to the client or to our managers and explain what exactly was going on in the Donner said. All right, As you can see, it was all step by step. We slowly built this visualization, and that is exactly how this course is organized. You will learn our step by step, improving every tutorial, one skill at a time and learning a lot. And I can't wait to see inside the next section look forward to seeing inside the first tutorial, and until then, happy coding. 5. Welcome to the CORE PROGRAMMING SECTION section. This is what you will learn!: hello and welcome to the section on core programming principles. And what are we talking about in the section? Well, here we will cover off the core principles off programming just overall. So these things that we're going to learn our fundamental and universal they're not just applicable to our only there. Also the same in C C plus plus Java and pretty much any other programming languages in the single. And the reason why I decided to put the section in is because Norman and our courses, you are expected to learn about to the very sophisticated things in our right away. So you're thrown into the deep end. You're told about Victor's matrices, daughter frames and so on. Well, this course is different. We wouldn't really want to take it step by step. And I thought that it will be a good idea to first learn the fundamentals off programming to get you accustomed to this way of thinking. So having said that, if you already comfortable of programming and if you've learned other programming languages , then feel free to skip this section and move on to the are specifics starting from the next section. Otherwise I look forward to seeing on the first tutorial and make sure to fall along with the code. That way you will learn much Foster, and I'll see you on the first tutorial. 6. Types of variables: Hello and welcome to your very first tutorial on our programming. This is Curole, Eremenko and I am super excited to have you here. And today we're talking about the daughter types in our now we're going to cover five main data types, which are also called the Atomic Daughter Types in our So let's get started right away. Okay? I've got my window, our studio window open here and at the top of the left. This is we're going to write our code. So if you don't see this windows or this part of the window here in the top left, for instance, it looks like this. You only see the console and these other two windows. Then all we have to do is click this button up in the top left corner to create a new R script. So let's go ahead and do that. And now we have this new R script. Where were we will be riding our coat. All right, so let's start with ah, the into chur daughter type. So I'm going to put a hashtag and hashtag and r stands for comment. And why that is is because I want to type in something that doesn't that shouldn't affect the code and execution of the court. Now, I'm going to go into my settings here, and I'm using a Mac your butt. If you're using windows, then everything should be quite similar. And we've really done the layout off our code. But what I want to do is I just don't increase the phone size so we can see everything a bit better on, um, the recording. So there you go. So I want to create an integer. I'm going to start by giving the variable name The name is gonna be X. And then I'm going to put triangle a bracket facing towards X so kind of like a less than sign on, then a minor. So this creates an arrow. There we go. That's the arrow that we've created with these two symbols and in our this is the assignment operator and I want to assign X the value off to so it will be an integer off to but in our and we'll get to this in a second in order to make sure that this is going to be an image or we have to put a capital l off towards once again. We'll get back to that in a second. Let's just run this code for now. So in order to run this card, all you have to do is keep your core sore or keep this line selected. Basically, you see this vertical line of blinking. That means I'm on this current line and press control. Enter. If you're on a windows or Calmund, return on a Mac. And as you can see, what happened is this code has bean copied into the console and has been executed. And what we have now is ah, new variable in the global environment over here, so x and the value is to help. And now we're going to check what actual type does X have? And in order to check the type, all you have to do is type in type off and then in brackets put in the value that you want to check. So let's execute that. So, once again, I'm gonna click common return on my Mac. And here this code now has been copied to console. And now we can see that it is an integer. All right, so we've created our first integer once again. We'll get back to this l in a second. All right, let's have a look at the next type, which is the double type and double just basically means anything off a decimal point. So Ah, we're going to say double here. So this is gonna be out comment. So basically, anything with a hashtag that this start is completely ignored. I know we're executing line by line, but still, if you want to save your file later on, you don't want to get any warnings. Then you should put hashtags before anything that shouldn't be looks at that isn't part of your code. All right, so now we're going to create a double bearable. So let's called why? And then we'll put once again the assignment operator and will give it a value of 2.5. So it has a decimal point. And once again, let's execute this line. Press comment. Return on the Mac and they go, We've got this code was copied here and has been executed, as you can see, and right away, we've got a new or variable here with a new value. Now let's have a look at the type off. Why type off. Why? All right, so let's execute this line now. As you can see, it has been copied over here and executing that line. What the council return was double. So now we have two variables. One is an integer and one is a double. Okay, so now we can discuss this l symbol. So why do we have to put in l? Why can't we just say ex? Ah arrow to? Well, the reason is because by default, are will decide for you how it should store the daughter. And, um, all operations in our old earth. Medical operations are always conducted on a double level because it makes sense, right? If you're going to add, like, a double variable so something that has decimal points and it's something that doesn't have decimal points than the result of the operation might actually have decimal points. So it's logical that any operations are conducted with numbers that have decimal points. So that's why it's better for our to store anything as double so if you don't put a l here . So let's go here. Let's delete that and let's rerun this line so we will basically override our existing variable X over here. So I'm going to press Colin. Return on. Now. This variable has being created again and is against his ex is just too not a to l anymore . Now, if we check type of ex, you'll see that it's a double. So basically are by default will store your integer variable in this single X variable as a double just because it is anticipating that you will require arithmetic operations in the future. So and because they're going to be run in double mode anyway, it's just easier for our to store that variable like that right away. So if you know, for instance, that you're not going to be running arithmetic operations and, for example, this variable is just used as a category auras, um, you're giving sequences to something like like 1st 2nd 3rd to never gonna be adding them or you're never gonna be create running off arithmetic operations. Then you can just put an L here and that will tell are that this is definitely an integer and you want to stored as an integer. All right, we've done two. We've got three more to go. Okay, So what's the next one the next one is complex. We won't be stopping on complex for too long, but because it is a daughter type in our I thought, it's worth mended, mentioning. So let's say 23 plus two I. So if you've done math like a bit sophisticated math, then you'll know what complex numbers are. If you don't don't really worry about it, we won't be dealing with them. I'm just going to show you how they were here. So a zed is a complex number. It's three plus two I. And if you want to check type off a zed, you'll see that it is indeed complex. All right. Once again, we won't be stopping that for too long. So let's move on to the remaining two. They're going to our character. That's them one. And let's create a character. So we're going to call this variable. I'm gonna make some space here, and we're gonna call this variable A and inside A. We want to put some, um, text. Or let's say we want to put a letter when I put the letter H. So to put a letter into a terrible you need to put quotation marks and as you could see. So I'm gonna really redo that again. As you can see, as soon as I press the single Cho Tae Oh, press The double quotations symbol once are conveniently our studio conveniently creates a 2nd 1 for me, so I don't have to. I won't forget to close my quotation marks and then I can put a letter inside here and, as you can see, is being highlighted in a different color. And now I can check, type off a right. So what you'll see is if I just run type of a right now, I'll get an error type of a object, A not fallen. And that's because I haven't created this variable yet here. So you can't even see it here because I forgot to run this line. Ah, and, um, that is because our will only execute the lines that you tell it to run. So first, let's run this line. And now we can check type off A. As you can see, it is a character. All right, so that's how you basically store any kind of letters, text and so on. And finally we're coming to the lost A daughter type that would be looking at, and that is logical. So in order to create a logical variable, let's first Ah, give it a name. Let's say, will be Q. That will be the name of all variable. By the way, you don't have to limit yourself at just one letter for the variable. So let's say it will be Q one, for instance, and here will assign it a value off. True. So logical variables are basically either true or false, and here we're going to assign value of True and for true will. Just use the letter T and a normal type type off Q one first will run this line. And as you can see now, we have a variable here. True, and now we'll run this line. As you can see, it's logical. By the way, there are other ways you can create a logical variables. So, for instance, you could say Q two is not true, so you can do true or you can do F or you can type in the whole world. But it has to be in caps, so Q two is false and now will be tie type in type off cute to check that as well. It's also logical. So that's how you create a logical barrels. All right, so that brings us to the end of today's tutorial. Hope you enjoyed it. Have a play around with that. Try experimenting, creating your own couple of variables just to make sure you understand how the different types work. And I look forward to your next time. Until then, happy coding. 7. Using Variables: Hello and welcome back to your course on our programming. How did you go the previous tutorial. I hope you found it quite simple to create variables and are, and if so, congratulations. Because this is the goal off the scores to smoothing out that very, very steep learning curve that are normally has and that students are normally presented with when they're starting their journey into arms. All right, now that we're comfortable with creating variables today we'll learn how to use them in different operations, varying from arithmetic operations to even cooling functions. But don't be afraid. Once again, everything is step by step, so we will learn just the right amount that we can handle and want to toil. All right, first things first. We need to save this file because it's always a good skill to have to know how to save the work you have done. So how do we save this file that we've created here with al Code? Well, it's pretty simple. If you're on a Mac and then press comment s if you're on a Windows PC than press control s or otherwise, just click this save button up at the top over here, So I'm going to press comment s. And here you just have to specify the name off your file. So I'll call a tutorial 01 and click safe. There we go. That is our off file saves. And now we're just going to create a new one by clicking the R script. But no, here, like we did lost them. And now we see a blank works, you know, here what we see here is in the global environment, we still have. Our variables are recorded last time. Let's clean them up. Now. There's a lot of ways to do it, but will stick to the basic one will just quick this broom over here and say yes, and that will delete everything. And lastly, we just got some code in the console and that's fine. Let's leave it there. It will disappear. As we create more code, it will scroll up and out of our visibility. All right, so let's start off. By creating available, we're going to create a variable called A and we put the value 10 into this variable. So let's type that code and run it. By the way, I hope you're fooling along because it's very important to follow along and do the exact same Ah, steps on your computer because that way you will learn are much faster than if you're just watching it so full along. And let's create a new variable. This style will create a bearable cold be and will put in the value life execute and, as we can see, were reduced to this. The code has been copied into the council, and it has been executed over here. So we've got the variable. All right, so let's say we want to add these two variables and put the result into 1/3 variable, which is C. Let's go ahead and do that. So here we go. There is the variable see, and we will assign at the value of a plus B. Very intuitive. So hit, return or run. And as you can see, the code has been copied into the console, and we've got the results over here now. First off, what I wanted to point out is that spaces in our don't matter, as in many, many or most programming languages. So basically I can remove these two spaces, rerun the code and it'll run just fine. The variable has been overridden. It's still 15. That is because spaces our studio, ignore spaces and there, basically there for your aesthetics. Now the second thing was hardly print out this variable. We know that the value off see is 15 because we see it here. But let's say we don't have access to what's going on in here, then alway left with is the consul and we can't see the value of seen here. We just see that this operation has gone through. How do we see the value of C? So in other programming languages, you might have to use a function like print or print, print F or alert or other source off functions in our it's very simple. Only have to do is just print the objects Name. Eso, in this case will just type in C and execute this line. And there we go. We've got the value 15. It has been printed out over here, so that is how easy it is to get objects to display on your screen. In our just basically print the name of the objects and execute that line. All right, let's move one Let's create another variable. So this time we'll give it a bit of a longer name. We'll call it very variable once of our one, and we will assign it the value of 2.5. And before we execute that code, let's create a second Marable right away, Well or less. Prepare the code for a second bearable variable too. Animal assigned it the value of four. Now, the other trick I wanted to show you here, was that in are you don't have to necessarily execute all of your code line by line, like we've been doing up to now. So, as you can see, the carriage return is here. So if I just hit Ah, run right now, then all that will be executed is just this line of code. But in our you can actually highlight the elements of code that you want to execute. So in this case, let's say I want to execute these two lines at the same time were not done at the same time . They will, of course, be executed one off to the other. But I will want to execute them together. So in this case, I highlight them and I hit. Run. And as you can see, both lines have been copied into the council and both lines have being executed. We've got two new variables. Terrible, one at variable, too. So that's how are you can execute bits of your coat. And now, actually, it makes much more sense why we have comments. So if I wanted to put comments to this code, let's say I would say variable one here and here I would say variable to Because of these, Hashtags are knows that he's a comments now. And if I were to execute this code, including the comments, then even though they're copied into the console are knows that it should ignore these two lines because they have hashtags at the start. So are, well, actually only perform operations based on these two lines that we actually want. So that is how you execute multiple lines and how that's how Commons tie into this whole coding in our exercise. All right, so we're done with the variable one and Maribel to now let's do some operations with them. Let's say we want to find out what the result off their division will be. It's a result off variable one divided by variable to and let's run that line. And now let's just print out. Result says he could see it. 0.625 All right, so let's run one more. I wanted to show you that not only you can perform operations with parables and include multiple variables in those operations, but you can actually call functions and pass values to those functions, which are your parables. Let's say I want to find out what the square root off variable to is variable to here is four. So our type in answer is sq rt variable to now here in this case, SK rt is a function and ah, the brackets indicate that the values inside are being passed on to this function. Now, don't be worried if functions seem a bit off like a gray area to you right now, that's totally fine. We're not going to dive deep into them now. We'll discuss them in a lot of detail down further down in the scores. What I wanted to show you here was just to illustrate that variables can be used in many different ways, including as arguments for functions. So in this case, let's Ah, run this line. And now let's print out our answer. As you see it is two, Which is correct. All right, so those are our Earth Medic operations. And of course, that's not limit. You can not only add and divide, you can multiply. You can subtract, you can get square roots. You can basically do any operation in our that you could think off on your simple calculator or even a complex calculator. But now what we're going to do is we're going to move on to character operations and see how we can work with some character wearables just to illustrate that. That is also possible in our. So let's start by creating a terrible cold greeting and into this variable will put the word Hello. So as you remember, you have to use quotation marks to tell our that you're creating a character, and then we'll create available cold name, and into this variable will put the word Bob. So we want to create a message for bulb soul. It's at some lines, and we want to create a message. Anyone to say Hello, Bob. So how do we add these two variables? together. Well, in our the function for adding two strings together is called paste. And to that function, we're going to pause the first variable which is greeting over here. And we're going to pasta second variable, which is a name over here. And if execute this once again, we got the era because I did not execute these lines. So how about we run all of these three together? So if we execute all of these three, I can see that 1st 1 of your second and third And now we can simply print out message over here. As you can see, we've got a low bulb. All right, so that's how we create and work of character variables as well. And once again, we use the function here. Don't worry. If it seems a bit complicated, we'll talk much more about the functions further down in this course. Okay, so that is us for today. I would like to invite you to practice with these variables and see what other pressures you can think off. So try multiplying. Try subtracting trying, for instance, maybe including not just two variables, but 34 maybe five variables in one operation and see what you get. Because, remember, practice makes perfect, and that is the best way to learn a new programming language. And I look forward to seeing you next time, and until then, happy coding. 8. Logical Variables and Operators: Hello and welcome back to, of course, on our programming today we'll talk about a logical variables and operators. Let's dive straight into it. First off, we're going to save the file of four our previous project. So once again, revenge Press Command s or Control s depends on what machine you're on, and we will give it a name tutorial 02 and just go ahead and click safe. And now let's create a new script. Once again, we will clean up the environment. Click Yes. And let's get straight into a logical uppers so logical operators can basically have two possible values on. We've actually already talked about these. So let's put a comment in Andi. One other possible values that they can have. They can either be true or they could be false, and it's important that it's old caps. And also you can use just the word just the letter T or just the letter F. But also it has to be caps. So what is a logical operator? Well, let's have a look at a couple of examples. Let's say we want to check if four is less than five, then we type in four less than five, and we run this line off code. What we get in result is the word true meaning that are is telling us that this the result off this operation is true. And that is because this operator here less than is comparing the two numbers four and five . That's another one. Let's check that if 10 is greater than 100 let's run that on. What we can see here is this line has been copied. It has been executed, and as you can see, it's false, which is correct. 10 is not greater than 100. Let's check another one. That's C four is equal to five and let's run this line of code once again. We get false because for is not equal to five. So these are examples off us using logical operators less than equal, greater than or equal to. In our there are actually quite a few logical operators, and we will be looking at 10 of them. Let's ah, list him out here. So the 1st 1 was eyes equal to 2nd 1 is not equal to So that's how you write it. Ah, an exclamation mark in an equal sign and also be careful that in the equal to operator, you have to use the double equation sign because in some programming languages a single equation is sufficient. Then we've got to them ah less. Then we got the greater. Then we've got them less than or equal to greater than or equal to. Then we've got the simple not, and I'll show you how to use that one in a second. Then we've got the or so in some languages you need the double vertical lion like that in our you have to be careful that you use only the single one because the double one will work. But it has a completely different meaning, and also you've got the single and for and and then one more, which is a function to check if something is true and it is true, and then you put the variable inside there. So let's have a look at a couple more. Some let's say I want to check. Your four is less than five, which we've already done, but I don't want to just print the result as we've been doing. I want to store in a variable now, as you can see our environment is empty here, so we don't have any variables because we've been just printing the results so far. So how about we put this result into variable animal cold? This terrible result? We know the Simon temporary. So what you can see is happening here is we're checking this and then the result of this operation is going to be stored in the result Variable. Let's go ahead and run this line. There we go. As you can see, this line has been executed and no value has been printed out because we haven't asked for that. And what we got is a variable with the value true which we can now just simply print out on a chick its value. There we go. It is true. Okay, so let's make some more space and no four curiosity purposes. Let's check the type of result which we know how to do from the first title. If we run this, we'll see that result is a logical variable, which is a type of variables which we are familiar with already and makes sense right. If it's a logical operator than the result of that would be stored in a logical variable. All right, so now let's say let's see how we can use the not operator. So this interesting one that we saw over here, let's say we have a new variable are result to very creative Carol. But anyway, a result too. And we want to use the not operators who will say not true. So ba