Save and load symbol lookup table
The previous exercise taught you how to set default arguments on a per-symbol basis, but those settings only last for the current session.
This exercise will teach you how to save and load symbol-based defaults by using saveSymbolLookup() and loadSymbolLookup(), respectively. You can use the file arguments to specify a file to store your defaults.
You can also use the getSymbolLookup() function to check per-symbol defaults before you try to load data using getSymbols().
Cet exercice fait partie du cours
Importing and Managing Financial Data in R
Instructions
The source for CP has already been set to "FRED".
- Use
saveSymbolLookup()to save the symbol lookup table to a file named"my_symbol_lookup.rda". - Set the source for
CPto"yahoo"using what you learned in the prior exercise. - Use
getSymbolLookup()to verify that the default source forCPactually changed from"FRED"to"yahoo". - Now use
loadSymbolLookup()to load the saved symbol lookup table.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Save symbol lookup table to file
# Set default source for CP to "yahoo"
# Verify the default source is "yahoo" for "CP"
# Load symbol lookup table from file