Displaying 1 result from an estimated 1 matches for "currlag2".
Did you mean:
currlag1
2002 Feb 09
1
How to access objects outside an R function
...A NA
I have written a function which uses two lag variables for
substitution. The substitution seems to be happening alright within
the function. However, as a last step, I am unable able to replace
these values in the original data frame
> exch.replace <- function (df, curr, currlag1, currlag2) {
if ((df[curr]==0) && (df[currlag1]!=0)) (
df[curr] <- df[currlag1]
)
else if ((df[curr]==0) && (df[currlag1]==0)) (
df[curr] <- df[currlag1] <- df[currlag2]...