[R-SIG-Finance] Sum volume by day and plot in xts
Joshua Ulrich
josh.m.ulrich at gmail.com
Sat Mar 12 14:57:27 CET 2016
On Sat, Mar 12, 2016 at 3:26 AM, Peter Neumaier
<peter.neumaier at gmail.com> wrote:
> 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)?
>
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.
> I am thankful for any directions on that.
> Peter
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
--
Joshua Ulrich | about.me/joshuaulrich
FOSS Trading | www.fosstrading.com
R/Finance 2016 | www.rinfinance.com
More information about the R-SIG-Finance
mailing list