1. Learn
  2. /
  3. Courses
  4. /
  5. Importing and Managing Financial Data in R

Exercise

Extract the Close column from many instruments

The previous exercise taught you how to use do.call(merge, eapply(env, fun)) to apply a function to each object in an environment and then combine all the results into one object.

Let's use what you learned to solve a very common problem. Often you will need to load similar data for many instruments, extract a column, and create one object that contains that specific column for every instrument.

Instructions

100 XP
  • Use new.env() to create a new environment named data_env.
  • Use getSymbols() to load data into data_env by using the env argument.
  • Finish the commands that have been started for you. Fill in the blanks with the appropriate functions.
  • View the first few rows of close_data.