[R] A faster plotOHLC() for the tseries package
Dirk Eddelbuettel
edd at debian.org
Sun Dec 14 20:56:03 CET 2003
Hi Gabor,
On Sun, Dec 14, 2003 at 02:35:40PM -0500, Gabor Grothendieck wrote:
>
> Dirk,
>
> Could you please explain to me how to interpret the lines
> that you posted (which I gather are intended to be used with
> some program that combines them with the original source)?
That is the usual paradigm of using output of diff(1)
$ diff -u old new > diff.txt
as input to the patch(1) program as e.g. in
$ patch < diff.txt # try patch --dry-run < diff.txt first
On win2k, you can get them for sure with Cygwin, probably also with
mingw/msys and likely also with BDR's set of tools to build R from source.
Patch, written by Larry Wall of Perl fame, reads an entry such as
> --- plotOHLC.R.orig 2003-12-14 12:02:20.000000000 -0600
> +++ plotOHLC.R 2003-12-14 12:03:42.000000000 -0600
> @@ -21,14 +21,9 @@
and knows to replace lines marked with '-' (taken be old the old file) with
those marked '+'. In this example, it is trivial as there is only one
segment in which the code
for (i in 1:NROW(x)) {
segments(time.x[i], x[i, "High"], time.x[i], x[i, "Low"],
col = col[1], bg = bg)
segments(time.x[i] - dt, x[i, "Open"], time.x[i], x[i,
"Open"], col = col[1], bg = bg)
segments(time.x[i], x[i, "Close"], time.x[i] + dt, x[i,
"Close"], col = col[1], bg = bg)
}
with
segments(time.x, x[, "High"], time.x, x[, "Low"], col = col[1], bg = bg)
segments(time.x - dt, x[, "Open"], time.x, x[, "Open"], col = col[1], bg = bg)
segments(time.x, x[, "Close"], time.x + dt, x[, "Close"], col = col[1], bg = bg)
> Alternately, could you just send the revised OHLC source?
Well, the source is different from what you find in $R_HOME/library/tseries/R
so you may as well edit there by hand. I don't have access to a windows box
right now, but if the above doesn't help email off-line and I start up the
laptop from work.
Hope this helps, Dirk
--
Those are my principles, and if you don't like them... well, I have others.
-- Groucho Marx
More information about the R-help
mailing list