Lecture 9

IIT Kanpur July 201
20 followers
Dec 1, 2023
Hello friend, welcome to the course foundations of R software and you can recall that in the
last lecture we started a discussion on how to do calculations in the R software and we
had considered two cases, first was that how can you do the calculations between the scalars
or among the scalars and how you can do the calculations between a data vector and a scalar.
And at this moment we are restricting ourselves to addition, multiplication, division and
subtraction for operations and later on once we understand these basic concepts that how
R works then I will try to take some more type of calculations.
So now in this lecture we are going to consider how R does the calculations when there are
data vectors, for example if there are two data vectors then how the additions are done,
how multiplication, division, subtraction are done, when we are trying to work in the
R software and we are trying to do these type of calculations.
So as we have seen that when we took a scalar versus a scalar that it was just like a calculator,
but when we took a data vector versus a scalar then the operation was little bit different
and it was not the usual operation or the way in which all most of the softwares work.
Similarly today when we are going to consider the operations with the data vectors you will
see that the way R works it is little bit different and you have to understand the process
that how R behaves, how R follows the instructions and I will try to take here a couple of example
and through those example I will try to illustrate that how R works and what are the rules which
R follows and that in turn will help you that when you are trying to write your own program
and if you want to do a certain type of calculations then you know how to write this calculation
so that R can understand and do the same thing which you want.
So let us begin this lecture and I will try to take here some example, in the beginning
I will try to explain you more so that you can understand that how these things are happening
and once you understand the first operation after that understanding the remaining operation
will be quite quick.
So now we are going to consider the operations between data vectors, I am saying between
because we are considering here a very simple case and these cases of two data vectors that
can be extended to any number which I will try to discuss later on.
So now let me try to first take a very simple example in which I have got a data vector
with 4 values 2, 3, 5 and 7 and the second data vector which also has 4 values minus
2, minus 3, minus 5 and 8 and you can see here that both the data vectors have the same
number of element, same number of elements or values.
There are 4 values in the data vector 1 and 4 values in the data vector 2.
So now if you try to see how this data vector is going to operate, well first I try to show
you what is happening and then you can understand it.
So suppose I try to write down here the data vector 1 and data vector 2.
So now if you try to see here these are here the positions, position number 1, position
number 2, position number 3 and position number 4.
Now in the data vector 1, in the position number 1 there is a element 2, you can see
here 2, 3, 5 and 7 and in the data vector here 2 these values are here minus 2, minus
3, minus 5 and here 8, right.
So now what will happen you are trying to make here an addition.
So now what will happen here is the following that the value which is at the first position
in the data vector 1 that is going to be added to the value at the first position in the
data vector 2.
So this will become here 2 plus minus 2 that will be here 0.
Next the control will come to the next value and then the value at the second position
in the first data vector that will be operated with the second value in the second data vector.
So this will become here 3 plus minus 3 which is equal to here 0.
Now the control will come to the third element and the operation on the third value in the
first data vector and the third value in the second data vector this is going to be done.
So this will become here 5 plus minus 5 which is equal to here 0.
And finally this operation will move further and it will come to the fourth value in the
data vector 1 and the fourth value in the data vector 2 and whatever is the operation
that is going to be done 7 plus 8.
So this will become here 15.
So what you can observe here that here the operations are made element wise that the
first element is going to be operated on the first element, second element is going to
be operated with the second element, third and fourth elements are going to be operated
with the third and fourth elements in another data vector respectively.
So what will happen here this and this minus 2 they are operated, this minus 3 and this
3 they are operated, this 5 and this minus 5 they are going to be operated and finally
the fourth values in the two data vectors they are going to be operated and you get
here the value 0, 0, 0 and 15.
Now the same type of operations will happen if you try to replace the addition with respect
to or addition in you try to replace addition with subtraction, multiplication, division
etc.
The operations are going to be element wise.
So now let me try to take here one more example.
So in this data vector what you can see here I have taken here 4 elements in the first
data vector and 2 elements in the second data vector.
So what will happen here if I try to write down exactly in the same way.
So there are 4 positions 1, 2, 3 and here 4 and in the data vector 1 there are values
here 2, 3, 5 and 7 that you can see here which I have written here right and in the second
data vector there are only 2 values 8 and 9.
So I try to write down here 8 and 9 now and you want to do here addition.
So now the same rule is going to be applied and the same type of operations will happen
but let us try to see what happens.
So as we have discussed that the operations are element wise.
So the first element in the data vector 1 will be added with the first element in the
data vector 2.
So there is no issue.
So 2 plus 8 it will become here 10 and then the control will move further and control
will try to consider the second value in the first data vector and the second value in
the second data vector and it will try to add here 3 and 9 which will give the answer
12.
Now the control in the data vector comes to position number 3 here and it tries to
write here 5 and then here plus but now when it comes here this place is blank and the
same thing happens when the control comes to the fourth value here and then it comes
to the second data vector here this value here is blank.
So now what R is going to do is the following.
It will try to consider the first two values and it will try to copy and paste in the second
two values.
So what will happen here is the following that these two blank places will be replaced
by 8 and 9 exactly in the same order in which they are written and then the operations will
be done here that in the value at the third place which is here 5 and the value at the
third place in the second data vector which is here 8 they are going to be added and you
get here an answer 13 and similarly the value in the fourth places in data vector 1 and
data vector 2 they are going to be added and you get here the value 16 and you get here
these four values 10, 12, 13, 16.
So what you have to understand here that when we are trying to work here that then
these two values they are added to the respective positions in the first data vector and then
after that there are no value for the second set.
So these values come here again and they are added to these values.
So there is a sort of repetition.
So the values in the data vector which are lower in number in comparison to other one
they are repeated.
But here what you can see I have taken an example here where the number of elements
in the first and second data vector they are the exact multiples.
So data vector 1 has 4 elements and data vector 2 has 2 elements.
But now what will happen suppose if data vector 1 has 4 elements and data vector 2 has suppose
3 elements what will happen?
So let us try to understand this thing also.
So now if you try to see here in order to explain you this operation I am trying to
take here one data vector which has 4 elements 2, 3, 5 and 7 and second data vector which
has got value 8, 9 and 10.
So let us try to understand the same operation as we have understood in the other two cases.
So the first data vector here is C 2, 3, 5, 7 and then these are located at the positions
1, 2, 3 and 4 and in the second data vector the values are here 8, 9 and 10.
So now we can just try to do this operation of addition.
So the same rule whatever we have discussed that is going to be followed that the control
will come to the first position in the first data vector and first position in the second
data vector and these two values are going to be added say 2 plus 8 which is equal to
here 10.
Now after this the control will come to the second value in the data vector 1 and the
second value in the data vector 2 and this becomes here 3 plus 9 which is equal to here
12.
After this following the same rule the data vector will come to the third value in the
first data vector and the third value in the second data vector this will become here
5 plus 10 and it will become here 15.
Now when the control comes here to the fourth place in the data vector 1 and the fourth
place in the data vector 2.
So now you can see here that this place here is blank, there is no value in this place
here.
So now R is confused what to do?
So what it does here is the following that it take the data vector of the shorter length
once again.
So the data vector of the shorter length here is like this 8, 9 and 10.
So this 8, 9 and 10 that is going to be repeated here.
So now in this place this is going to be filled with here 8 and then 2 more values
here 9 and 10 they will also come here.
So now the R will start the operation and then it will try to add here 7 and 8 this
will give you the answer 15.
Now after this R once again become confused why confused that now there are 2 values in
the data vector 2 and there is no value here in the data vector 1.
But now R do not want to move further.
So R stops here and it gives the same answer here 10, 12, 15, 15 you can see here but it
gives you a warning message.
And warning message says that the longer object length is not a multiple of shorter object
length.
So R is trying to inform you that the length of the 2 data vectors are not the same as
well as they are not also the exact multiples.
So it is trying to do something but please try to be watchful and try to see whatever
R is doing is it correct or not.
And you can see here the same operation when it is done on the R console also.
So this is how actually R works and I am sure that now you will understand that how R is
doing the things but before moving further with other operations I would try to show
you that what happens when you are trying to do it in the R console.
So if you try to take here 2 data vector 2, 3, 4 and here 5 and if you try to add here
with say another data vector here say 10, 11, 12 and 13 so you can see here means the
first value in the data vector 2 is added with the first value in the data vector 2
that is 10 and this value 3 in the data vector 1 is added with the value 11 in the second
data vector which are and both are in the second place.
Similarly, the third value in the data vector 1 is 4 and the third value in the data vector
2 is 12.
So 12 and 4 are added and you get here 16 and similarly the fourth value in the data
vector 1 and the fourth value in the data vector 2, they are added together and you
get here the answer 5 plus 13 as 18. Now, I try to do the same thing, but I try to reduce
the number of the elements in the second data vector. So, now my first data vector has 4
elements 2, 3, 4, 5 and the second data vector has only 2 elements 10 and 11.
So, now let us see what happens. So, this 10 and 11, they move from here and they come
to 2 and 3 and then the values at the respective places they are added together. So, 2 is added
with 10 and 3 is added with 11. So, this becomes here 2 plus 10 12 and 3 plus 11 14. Now, 10
and 11, they come here on the third and fourth element in the data vector 1 and then 4 and
10 are added to give you an answer 14 and 5 and 11 are added to give you an answer 16.
So, this is how the things happen. Now, I try to do the third operation that
I try to keep 4 elements in the data vector 1 and only 3 elements in the data vector 2. So,
now if I try to do it here what will happen this 10, 11 and 12, they will move from here and they
will come to the first 3 values or the values in the first 3 position in the data vector 1 and the
respective values are added. So, 2 will be added with 10, 3 will be added with 11 and 4 will be
added with 12 and then after that there is nothing. So, the same data vector will be repeated again
here and the last value in the data vector 1 which is 5 will be added with 10, but now there are no
more values in the data vector 1 where 11 and 12 can be added. So, 5 plus 10 will become here 15
and after that R will give you a warning message that the longer object length is not a multiple
of the shorter objective length. So, this is what is happening this is the way in which the R
software actually works and it does the calculation. So, I hope I have explained you in detail how this
addition is happening. Now, the same thing will happen with other operations. So, now it will not
be difficult for you to understand them very easily. So, now let me try to take a subtraction.
So, subtraction you know that I am taking here 2 data vectors 2, 3, 5 and 7 in the data vector 1
and minus 2, minus 3, minus 5 and 8 in the data vector 2. So, now what will happen the same
operation will happen element wise operation. So, the first value in the data vector 1 and
the first value in the data vector 2 they will be operated. So, now this will become here 2 this
minus and then here minus 2 which is here like this and it will give you an answer here 4.
Now, similarly now the control will come to the second value in the data vector 1 and the second
value in the data vector 2 and then this and this they are going to be operated like 3 minus inside
the parenthesis minus 3 this value and then it will become here 6. Now, once again the same
operation is going to be repeated the third value in the data vector 1 which is here 5 and the third
value in the data vector 2 which is minus 5 they are going to be operated with this minus sign here.
So, this and this they will be operated like this 5 minus and within the parenthesis minus 5 and
this will give you answer the answer as 10. And finally, whatever is the value in the fourth
position in the data vector 1 and the fourth value in the data vector 2 they are going to be operated.
So, this 7 and 8 they are going to be operated and so this will become here 7 minus 8 and this
answer will become here minus 1 and this is here the operation. So, you can see here exactly the
same thing happened here also. And now if I try to take a similar example which I took in the
case of addition then I am sure that it is not difficult thing for you to understand that what
is happening. So, I am trying to take here 4 values in the data vector 1 and 2 values in the
data vector 2. So, now what will happen that these two values 8 and 9 first they will come here and
they will be operated with the first two values in the data vector 1. So, one value here 12 that
is the first value in the data vector 1 and another value 8 which is the first value in the
data vector 2 they will be operated as 12 minus 8 and the answer will come out to be here 4.
And then after this the value 9 will be operated with 13. So, the second value in the data vector
1 and the second value in the data vector 2 which are here 13 and 9 they will be subtracted and the
answer will come out to be here minus 4. Now after this R does not know what to do.
So, what it will try to do it will try to copy the same data vector which is of shorter length
8 and 9 and it will try to bring it here and this 8 and 9 will be operated with the remaining two
values in the data vector 1. So, it will become here 15 minus 8 this will become here 7 and then
17 minus 9 which will give you here 8. So, the third value in the data vector 1 will be operated
with the so called first value in the data vector 2 and the fourth value in the data vector 2 which
is 17 this will be operated with the second value in the data vector 2. So, this repetition will go
on so and then you will get here an answer like 4478. I hope it is not difficult for you to
understand. And now I try to repeat the same type of calculation which I did earlier in the case of
addition that I try to take here 4 values in the first data vector 12, 13, 15 and 17 and then 3
values in the data vector 2. So, what will happen here see 12, 13, 15 and here 17 and in the data
vector 2 the values are going to be here 8, 9 and 10. So, first of all this block is going to be
operated and your answer will come out to be 12 minus 8 using this and this, this and this, 13
minus 9 and this and this 15 minus 10. So, this will become here 4, 4, 5. Now after this when the
R software wants to repeat it the problem is that here we have one value, but in case if it repeats
here so this is here 8, but now after this there are 2 more values here 8, 9 and 10, but here in
this case these 2 values are missing. So, now in the second step this block is going to be
operated, but only the first available value which is here 17 minus 8 this will be operated,
but now there are no values here and here. So, this will be something like this question
mark minus 9 and question mark minus 10. So, R does not know what to do with this thing. So,
it will stop here at this place itself and it will give you a value here 4, 4, 5, 9,
but it will also give you here a warning message that the longer object length is
not a multiple of shorter object length. So, you can recall that in the beginning
when I introduced the R in the very first lecture I had informed you that R always
give you an error message which are user friendly that if you try to think about them try to
understand them you can understand what R is trying to inform you. So, this is how the subtraction is
happening in the case of R software. So, now let me try to give you this operation also on the R
console. So, suppose if I try to take here some values 11, 12, 13 and 14 and if I try to subtract
it with here c 1, 2, 3 and 4 right. So, you can see here that the first value in the data vector
1 will be subtracted by the first value in the data vector 2. So, that will become 11 minus 1
which is 10, then the second value in the data vector 1 will be subtracted by the second value
in the data vector 2. So, this will become 12 minus 2 10, then the third value in the data
vector 1 13 will be subtracted by the third value in the data vector 2 this is 3. So,
13 minus 3 is 10 and similarly the fourth value in the data vector 1 will be subtracted by the
fourth value in the data vector 2 which is 4 it will once again be 14 minus 4 is 10.
So, now you can see here all the values are here 10, but you know that these 4 10s are obtained
by different operations right ok. Now, I try to take here one more example here and I try to say
subtract here only 2 values say 2 and 3 right. So, you can see here now what is happening this 2
and 3 they will come over the first 2 values 11 and 12, then 11 minus 2 and 12 minus 3 both will
give you the answer 9 and 9. Once again this 2 and 3 will operate over 13 and 14 this will become
a 13 minus 2 and 14 minus 3 which is here 11 and 11 and so you get here this value.
And similarly if you try to take here one data vector with 4 values 11 12 13 14 and the second
data vector with only 2 3 4 here what you see it is like this. So, this 2 3 and 4 will be operated
over the first 3 values 11 12 and 13. So, 11 minus 2 is 9 12 minus 3 is 9 and 13 minus 4 is also 9.
So, you get here these 3 9s and after that this 14 will be subtracted by 2 which is here 12,
but after that there are no values in the data vector 1 from where the remaining 2 values of
the data vector 2 which are 3 and 4 can be subtracted. So, it will stop here, but it
will give you here a warning message ok. So, now I am sure that you must have understood
that how R works and now it will be easier and faster for us to understand the division
and multiplication also. So, now I try to take the example of multiplication which is quite quick.
So, I try to take here a similar example that 2 data vectors of the same length first data
vector have 4 values 2 3 5 and 7 and second data vector have these values minus 2 minus 3 minus 5
and 8. So, now the same thing will happen that if I try to write down here c 2 3 5 7 from the
data vector 1 and from the data vector 2 if I try to write down the values minus 2 minus 3 minus 5
and here 8 then it is multiplication. So, what will happen the values at the
respective position they will be multiplied together 2 into minus 2 this will become here
like this minus 4 and then this value 3 into minus 3 will happen here then 5 into minus 5
will happen here then 7 into 8 will happen here. So, you can see here that the first position in
the data vector 1 is multiplied with the first position in the data vector 2. So,
this becomes a 2 into minus 2 which is here minus 4. Then the second position in the data
vector 1 and the second position in the data vector 2 which are 3 and minus 3 respectively
they will be multiplied here and the answer will come out to be here minus 9.
And after this the third value in the data vector 1 and the third value in the data vector 2 they
will be multiplied and this answer will be 5 into minus 5 which is here minus 25 and finally,
the fourth value in the data vector 1 and the fourth value in the data vector 2 they will be
multiplied here as 7 and 8 and you will get here an answer and this is the screenshot of the same
operation. Now, in case if I try to take here a similar example that if I try to now choose here
2 data vectors in which first data vector has 4 elements and the second data vector has 2 element
which is the exact multiple of the length of the longer data vector. So, in this case what will
happen once again the C 2 3 5 7 will come then C 8 and 9 will come. So, in the first shot what
will happen that this block is going to be operated and you get here 2 into 8 that means,
you try to multiply the first positions in the data vector 1 and 2 and the second positions in
the data vector 1 and 2. So, you will get here 3 into 9 from here. Now, what will happen this
8 and 9 they are going to be repeated. So, this 8 and 9 this will be repeated here and it will
become here 8 and 9 and then once again 5 into 8 and 7 into 9 that is the third position in the
data vector 1 and the first position in the data vector 2 then the fourth position in the data
vector 1 and the second position in the data vector 2 they will be multiplied here and you
get here a answer like 16 27 40 and 63. So, you can see here the same logic same rule has
been applied here also. Now, I try to take a similar example which I took in the means earlier
3 3 cases here that I try to take here the data vector 1 which has only 4 elements and the data
vector 2 which has only 3 elements. So, the same thing will happen here once again. So,
you will have a 2 3 5 7 in the data vector 1 and data vector 2 will have a c 8 9 and 10.
So, their respective positions are going to be multiplied. So, first this 2 and 8 then 3 and 9
and then 5 and 10 they are going to be multiplied. So, this first position in the data vector 1,
first position in the data vector 2, 2 and 8 will multiply you get here an answer 16 then
the second data second position in the data vector 1 and data vector 2 they are multiplied
3 into 9 which gives you a 27 and then the third position in the data vector 1 and third position
in the data vector 2 which are 5 and 10 they are multiplied and you get here an answer 50.
And after this what happens that the same data vector this will be replaced here 8 9 and 10. So,
now, 7 and 8 will be multiplied here like this 7 will be multiplied by the first element 8 and
this will give you an answer 56, but now what to do here with the remaining 2 position in the data
vector 1 which have to be multiplied by 9 and 10 or does not know. So, it will give you value the
first value second value third value and fourth value, but here it will not be able to do anything
and it will give you here a warning that the longer object length is not a multiple of shorted
object length and so, this is here the screenshot of the same operation when you try to do it on
the R console. So, let me try to quickly show you these operations on the R software also so,
that you can understand them very easily. So, if I try to take here a data vector C
2 3 4 5 and if I try to multiply it by here means another data 7 8 9 and 10.
So, you can now see here that so, you can see here why it is giving you here error you know
what mistake you have done or I have done that I have taken here capital C, but it has to be here
small c right. So, if you try to see it here now it will work. So, this 2 is going to be
multiplied with 7 3 in the second position in the data vector 1 is going to be applied with
the second positions value in the data vector 2. So, this will be 3 into 8 and then third and fourth
value in the data vector 1 which are 4 and 5 they are going to be multiply with the third and fourth
values in the data vector 2 which are 9 and 10 respectively and you get here the values 36 and
50 4 into 9 is 36 and 5 into 10 is 50. Now, in case if I try to make the length
of the second data vector to be of only 2 such that it is the exact multiple of the length of
the longer data vector. So, now, you can see here the answer comes out to be like this because what
is happening the 7 and 8 they are coming to the first data vector and they try to multiply with
the elements in the first and second positions and then the remaining 2 positions at the third
and fourth positions they are once again multiplied by 7 and 8. So, you get here 4 4 into 7 is 28 and
5 into 8 as 40. Now, in case if I try to make it here say here the third value as 9. So,
that the second data vector has 3 elements and the first data vector has 4 elements. So,
if you try to multiply here the 7 8 9 this is going to be multiplied with 2 3 and 4 respectively
and after that this 5 is going to be replied with the first element which is 7. So, you get
here answer 2 into 7 is 14 3 into 8 is 24 4 into 9 is 36 and then 5 into this 7 this is 35.
But after this R cannot do anything. So, it is giving you here a warning message that ok that
the longer object length is not a multiple of the shorter objective length. So, this is how
the multiplication goes. Now, finally, about the division now I am sure that you have understood
it all the operations. So, it will not be a difficult thing for you. So, you can see here
that I am trying to take here 2 data vectors first data vector has 4 elements 24 28 and 16
and the second data vector has also 4 elements 3 4 2 and 8. So, you are trying to divide. So,
what will happen this once again the division will be done with respect to the position.
That means, the first value which is at the first position in the data vector 1 will be
divided by the first value which is at the first position in the data vector 2. So,
this will become here 24 divided by 3 this will become here 8 and then the value at the second
position in the data vector 1 which is 20 value at the second position in the data vector 2 which
is here 4 20 and 4 they will be divided. So, this will give you here an answer 5 and
then the value at the third position in the data vector 1 which is 8 and the value at the third
position in the data vector 2 which is here 8 they are going to be multiplied and you get here 8
divided by 2 which will give you here answer 4 and then finally, this the value at the fourth
position in the data vector 1 which is 16 and the fourth value in the data vector 2 which is 8 they
are going to be divided. So, this will give you 16 divided by 8 this will give you answer 2 and
this is here the screenshot. So, this is a very simple operation.
Now, I try to take here similar examples which I have taken earlier in the case of addition,
subtraction and multiplication that I try to take the first data vector of the length 4 and the
second data vector of the length 2 such that the second data vector is an exact length of the first
data vector. So, now, the same operation will happen that this 4 and 2 they will first come
to the first two elements of the data vector 1 and they will operate over the first two values
which are 24 and 20. So, you can see here 24 is divided by 4 and 20 is divided by 2 and you get
here an answer 6 and 10. Now, second shot what will happen in the second step that once again
this 4 and 2 will travel to data vector 1 and they will come here over 8 and 16.
So, 8 will be divided by 4 and 16 will be divided by 2 and then you get here an answer 2 and 8
respectively. So, this is the screenshot of the same operation and similarly if you try to take
here the last operation that where you are trying to take the first data vector of the length 4
which has 4 values 24, 20, 8 and 16 and the second data vector which has only 3 values and
which are not the exact multiple of the length of the first data vector. So, once again the same
operation will happen it will like 24, 20, 8, 16 and then it is here 4, 2 and here 8. So,
now first of all this block will be operated and the element wise operation will be done and then
this 24 will be divided by 4, 20 will be divided by 2, 8 will be divided by 8 and then you get
here the answer here like this which is here 6, 10 and 1. Now, after this R does not know how to
proceed. So, it will try to copy here 4, 2 and 8 the same block over here, but now there are no
values in the first data vector where the operation can be done. So, this 16 divided
by 4 will be operated and it will give you answer here 4, but then after what to do with the 2 and
8 data vector 1 that is not known to R software. So, it will stop here and it will give you here
a warning message that the same warning message that the longer object length is not a multiple
of the shorter object length. So, this is how the R software works when you are trying to division
in the case of data vector. So, let me try to show you these operations on the R console so
that you can understand them very easily. So, if I try to take a 2 data vectors suppose here
I try to take here 4, 8 then 12 and then here 16 and I try to divide them by here the data
vectors here like as here 2 and then here 8 and then here 4 and then here 8. So, if you try to
see here what will happen here this 2, 8, 4, 8 will be divided by the respective position in
the first data vector 4, 8, 12 and 16 and you will get here an answer like as 2, 1, 3, 2, 4
divided by 2, 8 divided by 8, 12 divided by 4 and 16 divided by 8. Now, in case if you try to remove
two elements because that your second data vector is of the exact multiple of the length of the
first data vector. So, then the answer will become here 2, 1, 6, 2 because this 2 and 8 is going to
be operated over 4 and 8 and then over 12 and 16 and in case if you try to make it here the
second data vector of the length say 3 something like 2, 8, 6. So, you can see here that 2, 8, 6
that is going to be operated over 4, 8 and 12, but after this the 16 will be operated with 2,
but then what to do with 8 and 16 that is unknown. So, it will give you here a warning message.
So, this is how the operations are conducted in R software when you are trying to deal with
data vectors. So, you can see it is not difficult, but there is a different way,
there is a different approach and I will show you later on in the forthcoming lectures when
we try to do some computations that once you understand that how R is behaving with these
numbers, how R is operating with these numbers then your programming will become much easier.
Very complicated expression can be programmed very easily in R software and these are some
of the reasons why R became so popular. These calculations what are being made here in this
specific way they are trying to help us when we are trying to do the real programming at least
in statistics I know. So, now, once again you have a good homework today that you try to take
some values yourself some data vectors and then try to make such operations. Well, just in order
to make the lecture simple I have taken here only 2 data vectors, but you can take 3, 4 as many as
you want try to make different combination that out of 4, 3 data vectors they are of the same
length and say 4 data vector that is of different length either exact multiple or not and then try
to see this different combination means in the same expression you try to take plus minus division
multiplication try to use the BODMAS rule. There are many things which you can understand
today after this lecture. So, you try to practice it and I will see you in the next lecture with
more operation till then goodbye.
