Skip to content

Instantly share code, notes, and snippets.

@Oreotrephes
Created December 2, 2014 23:01
Show Gist options
  • Select an option

  • Save Oreotrephes/e57e629c5458ccc96a2d to your computer and use it in GitHub Desktop.

Select an option

Save Oreotrephes/e57e629c5458ccc96a2d to your computer and use it in GitHub Desktop.
At-a-glance coefficient table
summaryfunction2<-function(x,y){
signs<-substr(as.character(sign(x)),1,1)
signs[signs=="1"]<-"+"
significance<-cut(abs(y), c(0, 0.001, 0.01, 0.05, Inf), labels=c("***", "**", "*", ""), right=FALSE)
paste(signs, significance)
}
process<-function(lm){
coef<-data.frame(summary(lm)$coefficients)[-1,-c(2,3)]
coef$comb<-summaryfunction2(coef$Estimate,coef$Pr...t..)
vec<-t(coef[3])
vec<-data.frame(vec)
vec$dependent<-as.character(lm$terms[[2]])
vec
}
lm1<-lm(Sepal.Length~Petal.Length+Petal.Width,data=iris))
lm2<-lm(Sepal.Length~Petal.Length+Petal.Width,data=iris))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment