search for: bplag1

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

Did you mean: bplag2
2002 Feb 09
1
How to access objects outside an R function
...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 2.5740 0.0000 2 7306...