[tech-spec] Re: R editor

  • From: Dirk Eddelbuettel <edd@xxxxxxxxxx>
  • To: tech-spec@xxxxxxxxxxxxx
  • Date: Mon, 11 Oct 2004 16:03:53 -0500

On Mon, Oct 11, 2004 at 01:21:16PM -0700, BBands wrote:
> I agree and note that it supports a LOT more as well. :(

And there are so many 'little things' it gets right. E.g. you never lose a
keystroke as everything goes into temp file right away, and it tells you if
you forgot to save. It is network centric, it has the same keystrokes as
bash and other readline-using programs (like R) etc pp.  

Still being busy climbing off the soap box...
> In the meanwhile I tried to swap an its Yahoo! download for the ASCII file
> read in the neat Bollinger Bars charting package we collaborated on, but am
> having problems. (This is why I was looking for a cool R editor and
> debugger.) Is there an obvious reason an its object and the ASCII
> object--they do look exactly alike--should be incompatible?

Not really. Giles code borrows heavily from the code in tseries for the
download part, and then does pretty usual its() creation. Yqu can
debug it step by step by adding copious cat() calls in a local copy.

If there a problems, they are probably in the 2nd half of the short function:

#        y <- readcsvIts(destfile,informat="%d-%b-%y")
#        oneinstrument <- its(y[nrow(y):1,])[,quote]
## edd 23 April 2004  need to manually read and remove last line due to 
##                    Yahoo! now adding a trailing html comment 
## better version with help from Peter Dalgaard 
v <- readLines(destfile)             
cl <- grep("^<!",v)                 # look for html comments 
if (length(cl)) v <- v[-cl]         # and invert the grep 
data <- read.csv(textConnection(v)) # load all that do not match           
data <- data[nrow(data):1,]         # and inverse order in data   
y <- its(as.matrix(data[,-1]),                                             
         dates=strptime(as.character(data[,1]), format="%d-%b-%y")) 
oneinstrument <- its(y)[,quote] 
         names(oneinstrument) <- paste(instruments[i],quote)
         allinstruments <- union(allinstruments,oneinstrument)
You could do full 


or do the same with head() or tail() around whatever the difference is.

Hth, Dirk

Those are my principles, and if you don't like them... well, I have others.
                                                -- Groucho Marx

Other related posts: