Aan de slagGa gratis aan de slag

Set default arguments for a getSymbols source

You can also use setDefaults() on individual getSymbols() source methods. This exercise will teach you how to change the default value for the from argument to getSymbols.yahoo().

You can find the arguments for a specific method by using help() (e.g. help("getSymbols.yahoo") or by calling args() to print them to the console (e.g. args(getSymbols.yahoo)). Calling getDefaults() will show you the current default values (if there are any).

Remember, you are not supposed to call getSymbols.yahoo() directly!

Deze oefening maakt deel uit van de cursus

Importing and Managing Financial Data in R

Cursus bekijken

Oefeninstructies

  • Use the args() function to print all the default arguments to getSymbols.yahoo().
  • Set the default of from for getSymbols.yahoo() to "2000-01-01".
  • Use getDefaults() to confirm that the from default was set correctly.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Look at getSymbols.yahoo arguments


# Set default 'from' value for getSymbols.yahoo
setDefaults(___, ___ = "2000-01-01")

# Confirm defaults were set correctly
getDefaults("___")
Code bewerken en uitvoeren