Showing string in formula and not as variable in lm fit

How about eval(call(“lm”, sformula))? lm(sformula) #Call: #lm(formula = sformula) eval(call(“lm”, sformula)) #Call: #lm(formula = “y~x”) Generally speaking there is a data argument for lm. Let’s do: mydata <- data.frame(y = y, x = x) eval(call(“lm”, sformula, quote(mydata))) #Call: #lm(formula = “y~x”, data = mydata) The above call() + eval() combination can be replaced by do.call(): … Read more

Is there a faster lm function

Yes there are: R itself has lm.fit() which is more bare-bones: no formula notation, much simpler result set several of our Rcpp-related packages have fastLm() implementations: RcppArmadillo, RcppEigen, RcppGSL. We have described fastLm() in a number of blog posts and presentations. If you want it in the fastest way, do not use the formula interface: … Read more