Why is this R function throwing error -


i'm trying make simple wrapper function in r. throws , error , don't understand why.

set.seed(98) d1 <- data.frame(           y = factor(rep(c("a","b","c","d"),25)),            = rnorm(100),            b = rnorm(100) )   mlog_reg_p = function(f, d, ...) {      if(!(require("nnet"))) {         stop("package 'nnet' not installed. install.packages('nnet')")     }      syx = match.call()     su = summary(multinom(formula = f, data = d))     z = su$coefficients / su$standard.errors      p = (1 - pnorm(abs(z), 0, 1)) * 2      list(         syntax = syx,         model_summary = su,         p_values = p     ) } 

and when trying run it:

mlog_reg_p(y ~ + b, d1) 

it throws error:

error in stats::model.frame(formula = f, data = d): object 'f' not found 

what messing up?


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -