Open Bijaelo opened 3 years ago
I have had the same bug using npcdist
. The issue happens with a stored formula
object or a dynamic call for that function as well. Possibly related (although I have not looked into it in detail) is an error thrown when using the ~.
formula syntax.
library(np)
df<-data.frame(y=rnorm(10),x1=rnorm(10),x2=rnorm(10),x3=rnorm(10),x4=rnorm(10),
x5=rnorm(10))
npcdist(formula = y ~ ., data = df)
On the other hand, I have been able to use a formula
object with npreg
.
Based on this SO question.
There's currently a problem when providing a formula in any non-standard way. Either in a stored variable or as a result of dynamic call. Illustration:
The error comes from the way the formula is extracted. And potentially this affects more than just the formula:
The problem in this case is within
explodePipe
andnp:::npplregbw.formula
. Since the formula is given as an unevaluatedcall
. This might be a problem in other parts of the function as well. A quick fix would be to force evaluation of the formula inexplodePipe
Note that extracting arguments from
match.call
without evaluating them may be the cause of further bugs but I have not tested this.