R package for easily converting various existing r model to latex code and pictures. (In developing)
The idea comes from the final project of my regression class (STAT 462), where our dataset contains more than 60 predictors, and we have to fit 24 of them to the regression model. When completing the presentation as well as the report, we felt it was so annoying and boring for translating the model to latex code by hand because we did so much typing, copying, and pasting. Therefore, I developed this simple r package afterward to do all the work by one line of simple code.
- Create the function for converting the logistic regression and robust regression to latex syntax.
- Add some simple examples for demo purposes.
- Treat the normal, categorical predictors and interaction differently.
If you're using r studio, follow the code below to install this package.
install.packages("devtools")
library(devtools)
devtools::install_github("SecantZhang/rmodel2tex")
library(rmodel2tex)
Name | Description | Primary Function | Code in this package |
---|---|---|---|
Linear Models | Linear regression | lm( ) | lm2tex(model, type, round_num) |
Logistic Regression Model | Logistic Regression | glm( ) | glm2tex(glm_model, glm_type, glm_form, glm_round_num) |
lm2tex(model, type, round_num)
- model: The model generated by lm() function.
- type: Whether you want the latex syntax for population model, fitted model or both.
- "fit": Fitted model
- "pop": Population model
- "both": Both fitted and population model.
- round_num: Number of siginificant digits for the predictor coefficients.