So far, we have mainly dealt with the example in R to download and analyze stock data. With what you learned, you can download data from various assets other than stock data. You can download it or global stock information, just like we did for the US from Yahoo Finance. Whenever we start, we start by checking our workspace and it would be best if you loaded the package you need first in your R screen. Let's go to the content of the package to download other data. Once again, you're shown era if you do not go to the package and write package function, therefore please use the library command if there is an era. Now, let's get the HTC corporation stock price. The HTC cooperation is a Taiwanese company that manufactures and sells mobile phones. You can also use the get symbol function to get the stock price of HTC, in the same way as the stock prices of US companies. Just write HTC's ticker to 2498.TW in the first place of the vector. Let's download it. You can identify the ticker by visiting finance.yahoo.com and now writing the company name in the search box. Let's rename this data to HTC. Write the name HTC arrows, and when you start typing 2498.TW a box will appear where you can choose the name of the data. You select and click "Data" 0a a quotation mark appear around the name and you can create new name. This quotation mark appears when writing number format names. Of course, it doesn't occur when you write a name of data without numbers in front. Besides the stock data, we can also use R to get the exchange rate for several countries. You can import the exchange rate in the same way as the stocks using the function get symbol. I'll get the USDGBP, USDAUD, and USDEUR exchange rate. You can quickly check the exchange rate ticker by searching for the desired exchange rate on Yahoo Finance. In particular, the exchange rate with USD has a particular rule for the ticker, such as the name of the currency in the denominator equal x. Maybe you can enter it yourself. Let's set the period from January 1st, 2010 to December 31st, 2019 using the method we learned before. Periodicity is not specified then by default, it will appear the daily data. Let's try it. You can check that downloaded data in the environment. Then let's re-download all the global ETF we have used in the previous lecture. This time, we'll first store seven tickers of IVV, IDEV, IUSB, IEMG, IAGG, IJH to IJR in one vector. Then, I write the vector with the tickers in the place of the get symbol function. I downloaded the data from January 1st, 2015 to December 31st, 2017. By now, you must have been used to this. Now, I have downloaded seven SS data. You can do the same, although you have 500 tickers. If you have a 500 tickers in a CSV file, unread the CSV file and save it as a vector. We'll use all the tickers in the get symbol function without writing all of them. Of course, it will take a long time to download all 500 stock historical data from Yahoo. The seven assets I just downloaded are ETF data. I'll explain what these seven ETFs are briefly. We used this data this week so it might be better to have a little bit of information. First of all, IVV is the S&P500 ETF of ishare. Ishare is BlackRock's ETF brand name. IDEV is MSCI Internationally Developed Market ETF. IUSB is Total USD Bond Market ETF, IEMG is MSCI Emerging Market ETF. IAGG is International Aggregate Bond ETF. IJH is S&P Mid-Cap ETF and IJR is S&P Small-Cap ETF. They are all ETFs from the same company. They are the US developed and emerged market stock, the US and non-US bond. The US mid-cap and small-cap ETF overlap with the US' stocks, but I include it. Today I'll briefly introduce a crucial programming concept that is a function. You'll learn how to make functions. So far, we have used the function inherent in R and the package. Once you know how to make a function, you can create your own function. You can transform the existing functions or create from the scratch. Once you have made your function, you can code it quickly by setting a short name with the input variables. For example, I write the SD function and input the data in the round bracket to find the standard deviation. The SD had instruction for importing data and obtaining a standard deviation in each short name. But once someone defined, we'll now be able to do something similar. First, let us start by learning the basic structure of the function. If the name SD were to define data function to find data standard deviation, I'll make a function named plus dot function. The name of the function means a function that does an addition. I just made it like this to remember easily. I often use this kind of rule when I name my function. You can name your function in your way, however, make sure not to place the numbers in front of the name, it is inconvenient. First, if you want to define the name plus the major function, we need to start it as a function. I write down function, and then I open a round bracket and write X in the round bracket. Here, exceed the input that goes into the function. For example, what would be the input that goes into the function called SD? It has to be a numeric data factor or metrics. Now we create curly bracket and inside, write what the function has to do. I loaded a command in curly bracket to add 100 to the input X. Now let us see if this command there is a function named plus dot function and execute it to let R know about this function. Now you have created your function plus that function. Shall we use this function? What if we write SD and input the necessary data in small bracket and get the answer. Type plus that function and input one in the parentheses. Run it, the answer is 101. You know why? Because we defined the plus function as a function adding 100 to the input. Let us create our new function and name it get.Adprice. This one function allow you to perform two tasks we just did at the same time. First, write the function and then specify the input X in the round bracket, and inside the curly bracket, we now write the command to apply the two functions into X. First, apply the get function, and then apply add to the whole. Now, when you run this, you can define the function get.Adprice. Shall we use our function? Apply the get.Adprice function to the IVV and store it at IVV.Adprice. You can see that the function selected the adjusted price of IVV. Before today, you may have thought that the function is a bit difficult, but after practicing once or twice, I'm sure that you feel much more comfortable. The process of creating function is absolutely indispensable to get Intermediate programming skills. I hope you get used to it by practicing a few more times.