search for: dateoftrade

Displaying 1 result from an estimated 1 matches for "dateoftrade".

2002 Feb 09
1
How to access objects outside an R function
...ade(yymmdd). For some dates the returns are missing (recorded as zero) as there were no trades in that currency for that date. My task is to substitute the missing or zero values with the next non-zero value. To this end I created two lag variables: forexdata$counter <- rep(1:length(forexdata$DateOfTrade), 1); forexdata$bplag1 <- forexdata$bp[forexdata$counter+1]; forexdata$bplag2 <- forexdata$bp[forexdata$counter+2]; forexdata$counter <- NULL; > forexdata; DateOfTrade DayOfWeek bp cd dm bplag1 bplag2 1 730606 3 2.5715 1.0011 0.37700...