 Welcome, this is a course on dealing with materials data, we are going to talk about collection analysis and interpretation of data and we are looking at R to do this analysis and interpretation. We have started learning R and we have seen how to use R as a calculator and interpreter and in this session of the module, we are going to look at how to enter data into R and how to manipulate data and visualize data and so on and so forth. So for doing that, we are going to use a table of data and how to introduce this table into R and how to work with it is what we are going to learn and the data that we are going to use, the table of data that we are going to use is the crystal structures of some elements. Crystal structures could be FCC, BCC or HCP, these are the only three that I am going to consider in this table and for each we will take five elements, for example we will take aluminum, nickel, gold, silver and copper, for BCC we will take iron, chromium, molybdenum, vanadium and tungsten and for HCP we will take magnesium, beryllium, zinc, cadmium and titanium and the density and melting point, density in kilogram per meter cube and melting point in degree C that is reported in Raghavan in the material science and engineering textbook is what is given here. For example, aluminum has a density of 2700 kilogram per meter cube and melting point of 660 degree C, nickel has 8900 kilogram per meter cube and a melting point of 1453 degree C and similarly gold has 19320 kilogram per meter cube, it is much heavier or denser and the melting temperature is 1063 degree C and so on. So we have this data, what we want to do is to get this data into R and so we can start work with it and how to get this information into R in tabular format for further analysis is the question. There is a hard way and there is an easy way, of course today we are going to start with the hard way, the easy way is the one that we will do in one of the following sessions. So the hard way is of course to enter everything into R, so let us get that and because this involves lots of data and things like that. So I have already entered this data and I have made a script, so let us go to the script and it is called the elements. So we will now work through with this, ok. So what is it that we are doing in this script? So we can source the script and it is sourced. So let us start line by line. So this is the line which says elements is the name that I have given and it is a matrix. And this is the data for the matrix, so what does the matrix consist of? So it says for example, it is FCC 2760, FCC 8953, right. So like that we have all these values listed, FCC 1932, 19320, 163, FCC 10490, 961, etc. So we have and at the end after entering all these 15 elements, their density melting temperature, we are saying that there are 3 columns and the data is entered by row, right. We said this is for example, aluminum, this is for nickel. So each data is like 3 columns, so this 3 makes 1 row, next 3 makes the next row and so on, right. So we said that number of columns is 3 and it is by row the data is entered. So it is R knows that this matrix is made up of 3 columns and so every 3 it has to bunch and it has to make into a matrix. Columns have names, right. Columns of this object elements have names and what are the names? Crystal structure, density and melting point, right. So that is what it is. And the rows also have names, right, there are 4 row elements and the rows also have names. For example, aluminum, nickel, gold, etc. So it is also possible for example, you can make number of columns 4 and include the name here itself as aluminum, FCC 2760, nickel, FCC 8900, 1453, etc. And then you could have given the row names, so column names as the element and then crystal structure, density, melting point and then you do not have to name the rows at all. So this is an exercise that you are going to do, you are going to take this and modify it a little bit and then you are going to work with it. So and we are saying that this object elements it should be stored, this matrix that we have prepared in the name of element should be stored as a table and then if you say elements. So it gives you the list, right. So it says that there is crystal structure, density, melting point and there are all these elements aluminum, nickel, gold, silver, copper, iron, chromium, molybdenum, anodium, etc. And their crystal structure and their density and melting point is given. So let us go back to the nodes, so this is what we have done, so we have given the information by hand and we have prepared a table. And this is the table that we are going to work with for the rest of this session, right. So you can use this command class elements, so element, it is a table obviously because we said that the matrix should be stored as a table here, so it is stored as a table. So there is no surprise there, okay. Then what do we do, then we can say the structure of elements. So when you ask for the structure of elements, it says it is a table and it has this 15 rows and three columns and so those three columns I have information like string like FCC etc. and the numbers and the columns and the rows are labeled and the labels are crystal structure, density, melting point, aluminum, gold, silver etc. So this is what we have done and this is the information that it gives. So notice the difference when I say str within quote elements, it just considers this as a string, so it is just some characters. But when I say str of this table object name elements, then it gives me the information about this data, so that is what is done here, okay. Now let us use two more commands, head elements. So it gives you the first six rows of the data, of course you can also use tail and it gives you the last six rows. So remember it was FCC, BCC, HCP, so the last five are HCP and one before that was BCC. So you get all this information. So you can look at some aspects of the data using head, tail etc., these commands. So okay, so we can do that. Now what do we want to do? We want to separate the data according to crystal structure and plot the density against the melting temperature, okay. So this is the command that does that, okay. So let me copy this and put it here, okay. So what does it do? It stores in the variables x, y, z etc., the rows which have in the table elements the character FCC or the string FCC or BCC or HCP. Then it is going to plot by taking only those data, the second column of that data will be the density of that element and third column of that data will be the melting point of that element. So this is what it is going to do and let us do one by one so that we still have this information, okay. So this is, so let us run through one by one, okay. So this is for FCC, do you see a trend with the density, does the melting temperature increase? That is a good question to ask. We will ask and answer questions like this as we go along. Let us look at all BCC, so they also have this data. Let us take a look at HCP and they also have this data. And as you can see in the case of HCP it looks like lower density has higher melting point and higher density has lower melting point. I do not know if this is an actual trend but at least for the data that we have we can see something like that. Of course, suppose you wanted to get all these three figures, not like this individually that is what is shown here, there are three figures, this is what we got just now. But suppose we wanted to get them next to each other and here is a code does that, okay. So let me copy and paste it here. So this command par mf row column of 1 by 3, so it is going to put all these three figures in a row and so it is one row and there are three columns to this row. So that is what the figure is going to look like and as you can see. So now it becomes easier to compare. So for example, this is FCC, this is BCC, this is HCP and you can see that FCC densities the range is slightly different. So you have below 5000, here everything is above 6000 and here you go up to more than 18,000, of course there was gold here which was very high. And then here you have going from 2000 to 8000, there is nothing above 10,000 in the case of HCP and then in the case of melting temperature also. So the range is 1400, here it is above 3000 and here it is 1600. So it is easier to compare the data if you have these figures right next to each other. You can also plot the other way, let me try that, think you can, let us source this. Now you can see that you can also make this plots by aligning them this way. So you have now three rows and in each row you have only one plot and so you can play with it and you can get many different kinds of plots and you would have seen in the demo sometimes there were plots like this more than one plot of different aspects in the figure. And one can ask many other questions for example, can I get all this data in one single plot but with different symbols or different colors? You have seen in the demos that it is possible, how to do that is a question. So that we will do in one of the following sessions. So this module is just to show you that you can take data and you can by hand put data, of course it is very painful to enter data like this and it is also not possible to enter data like this if you have a large amount of data. This is some 15 lines and 3, 4 columns it is okay but if suppose you have to have some hundreds of lines or thousands of lines or you are just getting data from an experiment so it already comes in an electronic format. So how to get that data into R? So import data into R is something that also we will do in one of these sessions. But for now this is to enter data by hand and work with the data and like I said there is a small exercise based on this that you can do yourself by modifying this table a little bit and working with such a table. Thank you.