Session Ready
Exercise

Access the object using get() or backticks

At some point, you might download data for an instrument that does not have a syntactically valid name. Syntactically valid names contain letters, numbers, ".", and "_", and must start with a letter or a "." followed by a non-number.

For example, the symbol for Berkshire Hathaway class A shares is "BRK-A", which is not a syntactically valid name because it contains a "-" character. Another example are Chinese stocks, which have symbols composed of numbers. The Yahoo Finance symbol for the SSE Composite Index is "000001.SS".

You can use the get function or backticks (`) to access objects that do not have syntactically valid names.

Instructions
100 XP
  • Use getSymbols() to load data for "BRK-A".
  • Use backticks (`) and head() to look at the first few rows of data.
  • Use get() to assign the data loaded by getSymbols() to an object named BRK.A.