write model summary and plot to one pdf in r - r

My question is how to combine model summary and multiple plots into one pdf file.
This is what I'm trying to do:
pdf('model_result.pdf')
print(summary(my.model))
print(plot(my.model))
dev.off()
The resulting pdf file only contains the graph. No model summary. Do anyone know how to do that? Thanks a lot.

Related

How to display a large Regression output in RMarkdown (for PDF)

I am learning different statistical models and how to compute them using R.
I want to display the summary of a large multinomial logistic regression model in RMarkdown so that I am able to generate a PDF file.
However, only one page with the regression results is visible in the generated PDF file. The other results are simply cut off.
This is what I get:
I have tried the following code to output the summary of my model:
```{r, results = 'asis'}
texreg(model_pchoice)
```
I expect to generate a nice PDF File with an appealing table (spanning several pages if necessary). How could I proceed?

How to extract variables from tab_model in R to create new data frame?

Example output of tab_model
I have created a table from tab_model that includes multiple models and wish to extract all 'p-values' and 'Estimates/Odds Ratio' to create a data frame that includes these. Output of tab_model is an html file. I am unable to find a function to pull this info in accordance, any ideas on how I could do this?
For example, I want to retrieve all p-values and Estimates for variable 'age' in all of my models...Only 3 in example image but I have hundreds
You should get these values from the regression models themselves, instead of outputting them to a HTML-table, and then extract them.
Without further knowledge of your process and data it is difficult to provide a more concrete answer.

The Most Convenient Way to Insert Multiple Histograms within Latex-based Summary Statistics Tables (R)

I was wondering what is the most convenient way to create in R a summary statistics table (in Latex) with one column being graphic presentation of the distribution of that variable.
More specifically, I was looking for something like this:
Thanks!
I think you can do something like this with the sparkTable package. That package should give you TeX output.

How to use mtmm function r package psy without generating plot?

I am building a shiny app in which I want to be able to display the item subscale correlations data frame generated by the mtmm function of the psy package. I only need the data frame, but the function will generate a plot as well.
Is there a way of making mtmm() stop automatically generating the plot?
For an example of the function you can do this:
library(psy)
par(mfrow=c(1,5))
mtmm(ehd,list(c("e15","e18","e19","e20"),c("e4","e5","e6","e14","e17"),c("e11","e13","e16")
,c("e1","e10","e12"),c("e2","e3","e7","e8","e9")))
Many thanks in advance!

Any way to export data frames and graphs to a pdf without latex? [duplicate]

This question already has answers here:
Create a PDF table
(5 answers)
Closed 9 years ago.
I have several data frames and graphs that I want to place into a pdf file. I know of Sweave and knitr, but they both use latex to create a pdf file, and I don't want users of the code to need to download Latex before they can use it. Is there any way at all to send data frames into as a table (with a title) and graphs as the same document? If not, is there any way to send the data frames into one document and the graphs into another? I'd be glad to see any reasonable way, as long as it's possible to make it all automated.
One basic example,
library(gridExtra); library(ggplot2)
ggsave("plotntable.pdf", arrangeGrob(qplot(mpg, cyl, data=mtcars),
tableGrob(mtcars[1:10, 1:4]), ncol=2))
The plotrix package has the function addtable2plot, so you could open a pdf device and create your plots, then for the tables just create an empty plot (plot.new and plot.window) and use addtable2plot to put the data frame (if it is small enough) into the empty plot.
Yes, for graphs.
pdf(file = "pdf_demo.pdf")
plot(rnorm(10), rnorm(10))
dev.off()
See ?pdf for details, and ggsave if you're using ggplot2.
I'm not so sure about tables. You may be able to use pandoc and Rmd. Or just write the tables as .csv. Pandoc, at least, can be installed pretty easily using the installr package. Edit looks like Pandoc uses LaTeX to create PDF's.

Resources