Exercise

Setting the default data source

Recall from a previous exercise that getSymbols() imports from Yahoo Finance by default. In this exercise, you will learn how to change the default data source for getSymbols().

The setDefaults() function allows you to change the default argument values for getSymbols(). The first argument to setDefaults() is the function you want to update, and the remaining arguments are name = value pairs of the arguments you want to update and the value you want to use.

If you're tempted to try this with other functions, note that it only works with getSymbols() because getSymbols() actively checks to see if you want to use a different default value.