I have a dataset containing prices of multiple stocks on multiple dates (similar to the below one ) . I am trying to extract all the dates on which individual stocks did not trade (i.e. NA instead of numeric value) so the result would match the format "stock|date". I'm not sure how to approach this since i have a mixutre of headers (date) and the actual records (stock codes) in the first row and the only filtering i've ever done in R was using 'subset' function on data sets with proper column names. My real data set will have approx 2000 columns and 30 rows. Can anyone suggest an efficient way of extracting the NAs?
Data:
date Stock1 Stock2 Stock3 Stock4 Stock5
01-Jan 10 20 30 40 NA
02-Jan 10 NA 30 40 NA
03-Jan 10 20 30 40 NA
04-Jan 10 20 NA 40 NA
05-Jan 10 20 30 40 50
06-Jan 10 20 30 NA 50
07-Jan NA 20 30 NA 50
Result:
stock1 07-Jan
Stock2 02-Jan
Stock3 04-Jan
Stock4 06-Jan
Stock4 07-Jan
Stock5 01-Jan
Stock5 02-Jan
Stock5 03-Jan
Stock5 04-Jan