Skip to content

Sum volume by day and plot in xts

2 messages · Peter Neumaier, Joshua Ulrich

#
Hi all,

I am looking at half hourly OHLC in xts:

                   NGFH6.Open NGFH6.High NGFH6.Low NGFH6.Close NGFH6.Volume
2016-01-06 07:30:00     0.3395     0.3395    0.3375      0.3380           45
2016-01-06 08:00:00     0.3400     0.3400    0.3387      0.3395          140
2016-01-06 08:30:00     0.3395     0.3395    0.3379      0.3379           70

I'd like to plot my closing price for the day and sum up the volume (for
that day).

My current work around is

cbind(NGF[,"NGFH6.Close"],NGF[,"NGFH6.Volume"])

Summing up the daily volume and then plot (in manual steps).

Is there a more elegant way than above work around, i.e. select columns to
plot (without cbind), sum up volume by day and the plot closing price and
the daily sum (probably in one statement)?

I am thankful for any directions on that.
Peter
#
On Sat, Mar 12, 2016 at 3:26 AM, Peter Neumaier
<peter.neumaier at gmail.com> wrote:
As I said in my reply to one of your other messages: please read the
manuals.  What you want is described in section 3.4 of the xts
vignette.  Use to.period.