Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
75 lines (48 sloc) 2.8 KB


The mutable package provides a flexible method for generating markup tables from the R programming language. It allows users to construct objects representing arbitrary tabular material and output the object into a variety of formats. LaTeX, HTML, and plain text output functions are included by default.

Users can supply their own formatting functions for these output types, and easily create their own. For example, the provided LaTeX output style for factors (percentage and fraction) can be completely changed if the user specifies their own muExportLatex function. The modular design of the package allows every markup decision to be overridden easily and consistently. The result is that the user is in complete control over the final markup produced, and that multiple versions of the same table can easily be produced from the same data simultaneously.


install_github("mutable", "erikriverson")


Load sample data


Give unlabeled variables appropriate labels

label(airquality$Ozone)   <- 'Ozone (ppb)'
label(airquality$Solar.R) <- 'Solar R (lang)'
label(airquality$Wind)    <- 'Wind (mph)'
label(airquality$Temp)    <- 'Temperature (degrees F)'
airquality$Month <- factor(airquality$Month,
                           labels =[5:9])


Use the mutable formula interface to create a complete table, by default in plain text, LaTeX, and HTML formats

m1 <- mutable(Month ~ Ozone + Solar.R + Wind + Temp, data = airquality)

Print the table in the running R session


Print out HTML and LaTeX version of the table using default export functions. Note all rows/columns/cells are uniquely identified for CSS customization.


The table contains the following information.

Ozone (ppb)11623.62/22.2229.44/18.2159.12/31.6459.96/39.6831.45/24.1442.13/32.99
Solar R (lang)146181.3/115.08190.17/92.88216.48/80.57171.86/76.83167.43/79.12185.93/90.06
Wind (mph)15311.62/3.5310.27/3.778.94/3.048.79/3.2310.18/3.469.96/3.52
Temperature (degrees F)15365.55/6.8579.1/6.683.9/4.3283.97/6.5976.9/8.3677.88/9.47