 And I've navigated to this page where you can actually see all of the open data that is available or made available by the World Bank. Let's increase the size. There you go. All indicators. You can see the indicators on agriculture and rural development. You scroll down, aid effectiveness, climate change, economy and growth and all of these you can click on any of them and it'll open up a page like this. You can download some of the data as a CSV file. You can inspect some of the data and all these indicators have a unique name and you see that in the URL up here. It's a bit difficult to see. So it says se.sec.nenr and all of these indicators will have their own little abbreviation like that. And you can ask for some more detail about that. When you click on details, it will show you where that data comes from. So for most countries in the world and for many decades this data exists and you can just go out there and grab it for yourself. Fortunately, there's a package library in R that makes it very easy for us to use this data. So in this tutorial, I really want to look then at maternal mortality ratios using this World Bank open data. So I'm going to use an R markdown file as you can see here and my title there, author. The output is an HTML document with a table of contents being set to true and the number of sections being set to false. So that's my YAML up there and then I have saved everything that I'm going to use in the same directory as this notebook directory and I'm setting the working directory to get the working directory that this notebook is in. So the library that we're going to use is WDI, this World Bank data API library that you can download. I'm also going to use Plotly just to create a graph or two and then Deeplyer just to extract some of the data out of the data frame that we are going to create. As always, I use a bit of cascading style sheets just to change up the look of my file, my markdown file. And you can see I'm just coloring heading 1, 2 and 3. So if I create headings 1, 2 and 3 using markdown, it's a royal blue and a golden color. I also have this PNG file, which is my logo inside again of the same folder as this notebook. So I can just easily ask for it to be printed in the final HTML file. So as I've mentioned, you can read up on that. I'll put the links to where this page is. You can have a look here. It really is all this data that really is available. Now, if we scroll down, I've created a second heading 2 year looking up an indicator. We can look it up by country or by the name of the variable and the country codes. There are different country codes, the ISO2C, that is where there are just two letters to indicate the country. And we can also search for maternal mortality ratio in the name. So let's just do that. Let's run our first block of code here just so that everything is imported. There we go. Let's move down. And the first command we're looking at is WDI search. I'm using three of the arguments here, the first one being string. And that's just the string we want to pass what we want to search on. And I'm stating maternal mortality ratios. You can look through all those indicators and find it on the page there. Just use the find button on your browser just to find something that you're interested in. But you can also try it this way. The field that I'm interested in is name. And I'll show you all the fields shortly. And short equals false, meaning I don't just want a small bit of information. I want the whole lot of information from running the search. And you can see what we get there. We get two indicators that would have fulfilled a search for us. One is sh.sda.mmrt.ne and the other one does not have the ne in there. And there you see name. And these are the fields I'm referring to. So the field was name, so there's the name. And then there's also a description field. You can see it there, a source data field and a source organization. So you can see all the fields that are available that you can put in here as name there. I could put description or whatever I want to look in or even just indicator if I knew sort of what the indicator was. But I see one and two because there are two and it will refer to one and two describing all of these for me. So let's search some data. And I'm going to just dump it all into a data frame, just a good old fashioned R stats data frame called a DF. And I'm going to use the WDI command or function here. And the arguments that I'm going to use this country, the indicator, the start time, the end time and extras false. There's a lot of variables that can be collected or returned from my search but I only want the important ones. I'm putting extras false. So the country, I'm just passing a vector of strings here. So US for United States, BR for Brazil and ZA for South Africa. So we're going to pass those for the three countries. Now I know those are the ISO2C codes but you can also look up those codes yourself. The indicator is the one that I looked up that was returned here. I'm using this indicator here. So that's maternal mortality ratios modeled estimate per 100,000 live births. And I want the start time to be 2005 and the end time to be 2015. You get data up to 2016, 2017, but not for all countries. So just to keep things safe, I'm only going to go to 2015 for these three countries. And as I said, extra being false, it's not going to return all of the variables that are available only the important ones. So let's run that. And we see we have our data frame up here now. There we go. We can also have a look at it. Remember just by creating a new tab for it. Let's close here. There we go. We can see that it's all there and we can filter using our studio. Let's get back to our markdown file though. We see this double format. So it's nicely formatted for my screen. And what we want to do now, what I would like to do now is to show you if you asked for X-ray equals true, what you would also get. So you would get the ISO 2C, also the ISO 3C, the country. The actual values will be hidden inside of this indicator here. Here we get region, capital, longitude, latitude. So you can imagine if you use a package such as leaflet that you can draw beautiful plots with a map. So that could be done as well. So let's just filter some of the data. I'm going to create three new data frames. Brazil, USA and ZA I'm going to call them. And I'm going to use this pipeline method from deeplier. So DF, filter on the ISO 2C being Brazil. The ISO 2C being USA. The ISO 2C being ZA. So that's going to be this ISO 2C column here. I just wanted to group by... Not group by, I'm not using group by. I'm just filtering so that I only have Brazil, only have USA and only have ZA in these three different computer variables that I've created here. And let's plot them using plotly. Have a quick look. You can copy that. Or this file is on GitHub and it will be on RPUBS. So I'm creating three traces. And the traces will be this actual values for Brazil, USA and ZA. And then the dates, I'm just saying DTS for dates and that'll be Brazil.year. So that's going to give me all the years 2005 to 2015. So plotly, my DF.plot. I'm going to call here because my DF.plot that I created here is a data frame of DTS, trace 0, trace 1 and trace 2. All these traces that I've created up here. So on the x-axis is going to be my dates. On the y-axis will be trace 0. Remember that's Brazil. So I'm putting in a name, Brazil. The type is scatter and the mode is line plus markers. I form a pipeline because I want to add a trace and that'll be trace 1. Remember which was USA. So name is going to be USA. Everything else being the same. Add another trace and another one. And lastly we're just going to look at the layout. The title is going to be mortality, maternal mortality per 100,000 births. On my x-axis I have year. My y-axis I have count. And remember I'm setting my zero line in this list for x-axis and y-axis just so that I don't get the thick black lines in case it is drawn. So let's run that. And there we go. We have a beautiful plot. Interactive plot with plotly so that if I hover over I can actually get the data. And you can see how poorly South Africa has was around 2010 to 2011 and the changes that were instituted to correct this. But truly a horrible graph up there. So I've got some links down there for you for the WDI package. And also if you want to learn more about what was wrong with the maternal mortality rates in South Africa in case you're interested in that. So that's it. A quick look at how to use plotly and the WDI package for our and go around get your own data. I'm sure you're going to explore and stumble upon some wonderful data and information.