[tech-spec] Breakthrough with R

  • From: James Sogi <jsogi@xxxxxxxxxxxxx>
  • To: tech-spec@xxxxxxxxxxxxx
  • Date: Thu, 11 Nov 2004 21:38:03 -1000

Here's some simple stuff that .
Thought I'd share with the other 'remedial' members of the group.
#get some spy data from yahoo
library(its)
spy <- priceIts(instrument = c("SPY"), start = "2004-10-01",
+                          quote = "Close")
#check out sample
> spy[1:5,]
          SPY Close
2004-10-01    113.65
2004-10-04    113.84
2004-10-05    113.90
2004-10-06    114.68
2004-10-07    113.45
#find difference close to close with 1 day lag
diff(spy,lag=1)
          SPY Close
2004-10-04      0.19
2004-10-05      0.06
2004-10-06      0.78
2004-10-07     -1.23
#etc...part of results deleted
#pretty basic, but was a personal breakthrough and big thrill.
#'its' is  cool



Other related posts: