Reputation: 31
I have a data frame with a range of dates as the column names and a list of stock tickers down the y axis. I then have a separate character list of dates.
I want to create a subset of the data frame if the dates in the data frame match any of the dates in the character list.
Below please find links to images of the data frame and the list of dates. I would appreciate any advice as I have not been able to find a solution.
Upvotes: 0
Views: 186
Reputation: 308
If understand you well, you want your data's column which are on the list you put ?
I think this could work :
new_data = data[,which(colnames(data)%in%your_list)]
Tell me if this isn't what you want.
Upvotes: 2