I'm using getSymbols to import stock data from Yahoo to R.
When I store it in a data frame, it's in the following format.
          IDEA.BO.Open IDEA.BO.High IDEA.BO.Low IDEA.BO.Close IDEA.BO.Volume
2007-03-09        92.40        94.25       84.00         85.55       63599400
2007-03-12        85.55        89.95       85.55         87.40       12490900
2007-03-13        88.50        91.25       86.20         89.85       16785000
2007-03-14        87.05        90.85       86.60         87.75        7763800
2007-03-15        90.00        94.00       88.80         91.45       14808200
2007-03-16        92.40        93.65       91.25         92.40        6365600
Now the date column has no name.
I want to import 2 stock data and merge closing prices (between any random set of rows) on the basis of dates. The problem is, the date column is not being recognized.
I want my final result to be like this.
            IDEA.BO.Close      BHARTIARTL.BO.Close
2007-03-12      123                   333
2007-03-13      456                   645
2007-03-14      789                   999
I tried the following:
> c <- merge(Cl(IDEA.BO),Cl(BHARTIARTL.BO))
> c['2013-08/']
           IDEA.BO.Close BHARTIARTL.BO.Close
2013-08-06            NA              323.40
2013-08-07            NA              326.80
2013-08-08        157.90              337.40
2013-08-09        157.90              337.40
The same data on excel looks like this:
8/6/2013    156.75  8/6/2013    323.4
8/7/2013    153.1   8/7/2013    326.8
8/8/2013    157.9   8/8/2013    337.4
8/9/2013    157.9   8/9/2013    337.4
I don't understand the reason behind the NA values in R and the way to obtain a merged data free of NA Values.
 
     
    