Home > OS >  In R, make a "pretty" result table in LaTeX, PDF, or HTML from "IRR" package out
In R, make a "pretty" result table in LaTeX, PDF, or HTML from "IRR" package out

Time:10-12

Background

I'm using the irr package in R to generate some inter-rater reliability statistics for a project I'm doing. Here's an example of Fleiss's Kappa using the package's built-in data:

install.packages("irr")
library(irr)
data("diagnoses", package = "irr")
diagnoses2 <- diagnoses[, 1:3]
kappam.fleiss(diagnoses2)

This gives a simple little output table that looks like this in the R console:

enter image description here

The Problem & Desired Result

I'd like to "prettify" this output so that I can import it into a LaTeX document that I'm using to write up the results.

I'll take basically any format as long as its more or less automatic: LaTeX, a PDF or PNG image, even an HTML version of the table. The issue is that I have several of these output tables to make, and I'd rather not have to awkwardly convert them into LaTeX format manually. I'll do it if I have to, but I'd love to save the time.

What I've Tried

I've tried using knitr on this like so:

knitr::kable(diagnoses2, "latex")

But it doesn't work too well: cannot coerce class ‘"irrlist"’ to a data.frame.

I've looked at another 2 packages that've helped me in the past, texreg and stargazer, but their documentation doesn't say that they support irr outputs so I haven't actually tried them yet. (Though I will once I post this.) In the meantime, I'm also going through enter image description here

  • Related