I have a data frame df with one date column and 50 other columns with individual stock prices that are named after the respective stock. The first couple of columns of the data frame basically look like this:
df
Date        Adidas  Allianz  Shell  IBM  ...
2015-12-01  130     45       200    39
2015-12-02  131     46       199    40
...
I want to perform several actions (like calculating the daily return etc.) for which I always want a new column for the output.
As I want to retain an overview, my idea was to extract each stock column together with the Date column and put them in a new data frame to basically create 50 new data frames, one for each stock. Then, I would create a list of these 50 data frames to then perform all following actions with lapply-functions on the list. I do not want to type each column name into R individually, so is there any function with which I can extract one column after the other and put them into a new data frame always together with the Date column?
My new data should look kind of like this:
list
dfAdidas
Date        Adidas
2015-12-01  130
2015-12-02  131
...
dfAllianz
Date        Allianz
2015-12-01  45
2015-12-02  46
...
and so on.
Thankful for any tips or recommendations how to do this easier!
 
     
    