Displaying 1 result from an estimated 1 matches for "19830216".
Did you mean:
19830217
2012 Jul 06
1
Problem using Lag on time series
...bset(f,select=c(V1,V2,V3,V4,V5))
> names(f)<-c("date","open","high","low","close")
> f$test <-0
> f$test <- ifelse(f$close<Lag(f$low),1,ifelse(f$close>Lag(f$high),-1,Lag(f$test)))
> f
date open high low close Lag.1
1 19830216 1737 1742 1735 1739 NA
2 19830217 1738 1745 1738 1742 0
3 19830218 1740 1744 1738 1739 0
4 19830221 1730 1730 1721 1721 1
5 19830222 1715 1720 1714 1720 1
6 19830223 1711 1712 1702 1709 1
7 19830224 1708 1716 1708 1716 -1
8 19830225 1718 1726 1718 1718 -1
9 19830228 1712 1713 1701 1704 1
1...