Displaying 1 result from an estimated 1 matches for "bplag2".
Did you mean:
bplag1
2002 Feb 09
1
How to access objects outside an R function
...t 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 730607 4 2.5740 1.0017 0.37890 0.0000 0.0000
3 730608...